From a735f718cbdf7b212d7df202aafcc997b2d17eb6 Mon Sep 17 00:00:00 2001 From: yzhang87 Date: Wed, 25 Mar 2015 12:34:34 -0400 Subject: [PATCH] Fix the error for deleting node in MEL: 1) clean the mapping function, 2) if there is a null children, print a warning instead of a segmentation fault. Need more test when deleting a node in a recurrent loop. --- Demos/Simple/MakeData.m | 0 Demos/Simple/Simple.config | 0 Demos/Simple/SimpleDataTest.txt | 0 Demos/Simple/SimpleDataTrain.txt | 0 Demos/Simple/SimpleDemoDataReference.png | Bin Demos/Simple/SimpleDemoErrorRateReference.png | Bin Demos/Simple/SimpleDemoOutputReference.png | Bin Demos/Simple/SimpleMapping.txt | 0 Demos/Speech/CntkTimit.scp | 0 Demos/Speech/CntkTimitOutput.scp | 0 Demos/Speech/ComputeConfusion.m | 0 Demos/Speech/ConfusionData1.png | Bin Demos/Speech/ConfusionData100.png | Bin Demos/Speech/ConfusionData25.png | Bin Demos/Speech/HCopyTimit.config | 0 Demos/Speech/HCopyTimit.scp | 0 Demos/Speech/ShowConfusions.m | 0 Demos/Speech/SpeechErrorRate.png | Bin Demos/Speech/TimitGetFiles.py | 0 Demos/Speech/TimitLabels.mlf | 0 Demos/Speech/TimitStateList.txt | 0 Demos/Speech/TimitSubjectList.txt | 0 Demos/Speech/TrainSimpleTimit.config | 0 Demos/Speech/TrainSimpleTimit.sh | 0 MachineLearning/cn/ComputationNetwork.h | 37 +++++++++++++++++- .../figures/ConfusionData1.png | Bin .../figures/ConfusionData100.png | Bin .../figures/SimpleDemoDataReference.png | Bin .../figures/SimpleDemoErrorRateReference.png | Bin .../figures/SimpleDemoOutputReference.png | Bin .../figures/SpeechErrorRate.png | Bin .../lyx/CNTKBook_Introduction.lyx | 0 32 files changed, 36 insertions(+), 1 deletion(-) mode change 100644 => 100755 Demos/Simple/MakeData.m mode change 100644 => 100755 Demos/Simple/Simple.config mode change 100644 => 100755 Demos/Simple/SimpleDataTest.txt mode change 100644 => 100755 Demos/Simple/SimpleDataTrain.txt mode change 100644 => 100755 Demos/Simple/SimpleDemoDataReference.png mode change 100644 => 100755 Demos/Simple/SimpleDemoErrorRateReference.png mode change 100644 => 100755 Demos/Simple/SimpleDemoOutputReference.png mode change 100644 => 100755 Demos/Simple/SimpleMapping.txt mode change 100644 => 100755 Demos/Speech/CntkTimit.scp mode change 100644 => 100755 Demos/Speech/CntkTimitOutput.scp mode change 100644 => 100755 Demos/Speech/ComputeConfusion.m mode change 100644 => 100755 Demos/Speech/ConfusionData1.png mode change 100644 => 100755 Demos/Speech/ConfusionData100.png mode change 100644 => 100755 Demos/Speech/ConfusionData25.png mode change 100644 => 100755 Demos/Speech/HCopyTimit.config mode change 100644 => 100755 Demos/Speech/HCopyTimit.scp mode change 100644 => 100755 Demos/Speech/ShowConfusions.m mode change 100644 => 100755 Demos/Speech/SpeechErrorRate.png mode change 100644 => 100755 Demos/Speech/TimitGetFiles.py mode change 100644 => 100755 Demos/Speech/TimitLabels.mlf mode change 100644 => 100755 Demos/Speech/TimitStateList.txt mode change 100644 => 100755 Demos/Speech/TimitSubjectList.txt mode change 100644 => 100755 Demos/Speech/TrainSimpleTimit.config mode change 100644 => 100755 Demos/Speech/TrainSimpleTimit.sh mode change 100644 => 100755 papers/CNTK-TechReport/figures/ConfusionData1.png mode change 100644 => 100755 papers/CNTK-TechReport/figures/ConfusionData100.png mode change 100644 => 100755 papers/CNTK-TechReport/figures/SimpleDemoDataReference.png mode change 100644 => 100755 papers/CNTK-TechReport/figures/SimpleDemoErrorRateReference.png mode change 100644 => 100755 papers/CNTK-TechReport/figures/SimpleDemoOutputReference.png mode change 100644 => 100755 papers/CNTK-TechReport/figures/SpeechErrorRate.png mode change 100644 => 100755 papers/CNTK-TechReport/lyx/CNTKBook_Introduction.lyx diff --git a/Demos/Simple/MakeData.m b/Demos/Simple/MakeData.m old mode 100644 new mode 100755 diff --git a/Demos/Simple/Simple.config b/Demos/Simple/Simple.config old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleDataTest.txt b/Demos/Simple/SimpleDataTest.txt old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleDataTrain.txt b/Demos/Simple/SimpleDataTrain.txt old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleDemoDataReference.png b/Demos/Simple/SimpleDemoDataReference.png old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleDemoErrorRateReference.png b/Demos/Simple/SimpleDemoErrorRateReference.png old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleDemoOutputReference.png b/Demos/Simple/SimpleDemoOutputReference.png old mode 100644 new mode 100755 diff --git a/Demos/Simple/SimpleMapping.txt b/Demos/Simple/SimpleMapping.txt old mode 100644 new mode 100755 diff --git a/Demos/Speech/CntkTimit.scp b/Demos/Speech/CntkTimit.scp old mode 100644 new mode 100755 diff --git a/Demos/Speech/CntkTimitOutput.scp b/Demos/Speech/CntkTimitOutput.scp old mode 100644 new mode 100755 diff --git a/Demos/Speech/ComputeConfusion.m b/Demos/Speech/ComputeConfusion.m old mode 100644 new mode 100755 diff --git a/Demos/Speech/ConfusionData1.png b/Demos/Speech/ConfusionData1.png old mode 100644 new mode 100755 diff --git a/Demos/Speech/ConfusionData100.png b/Demos/Speech/ConfusionData100.png old mode 100644 new mode 100755 diff --git a/Demos/Speech/ConfusionData25.png b/Demos/Speech/ConfusionData25.png old mode 100644 new mode 100755 diff --git a/Demos/Speech/HCopyTimit.config b/Demos/Speech/HCopyTimit.config old mode 100644 new mode 100755 diff --git a/Demos/Speech/HCopyTimit.scp b/Demos/Speech/HCopyTimit.scp old mode 100644 new mode 100755 diff --git a/Demos/Speech/ShowConfusions.m b/Demos/Speech/ShowConfusions.m old mode 100644 new mode 100755 diff --git a/Demos/Speech/SpeechErrorRate.png b/Demos/Speech/SpeechErrorRate.png old mode 100644 new mode 100755 diff --git a/Demos/Speech/TimitGetFiles.py b/Demos/Speech/TimitGetFiles.py old mode 100644 new mode 100755 diff --git a/Demos/Speech/TimitLabels.mlf b/Demos/Speech/TimitLabels.mlf old mode 100644 new mode 100755 diff --git a/Demos/Speech/TimitStateList.txt b/Demos/Speech/TimitStateList.txt old mode 100644 new mode 100755 diff --git a/Demos/Speech/TimitSubjectList.txt b/Demos/Speech/TimitSubjectList.txt old mode 100644 new mode 100755 diff --git a/Demos/Speech/TrainSimpleTimit.config b/Demos/Speech/TrainSimpleTimit.config old mode 100644 new mode 100755 diff --git a/Demos/Speech/TrainSimpleTimit.sh b/Demos/Speech/TrainSimpleTimit.sh old mode 100644 new mode 100755 diff --git a/MachineLearning/cn/ComputationNetwork.h b/MachineLearning/cn/ComputationNetwork.h index a3c2b739b..9b54ca4fb 100644 --- a/MachineLearning/cn/ComputationNetwork.h +++ b/MachineLearning/cn/ComputationNetwork.h @@ -178,7 +178,14 @@ namespace Microsoft { namespace MSR { namespace CNTK { fstream << nodePtr->NodeName() << nodePtr->ChildrenSize(); for (size_t i=0; iChildrenSize(); i++) { - fstream << nodePtr->Inputs(i)->NodeName(); + if (nodePtr->Inputs(i) == nullptr) + { + fprintf(stderr, "Warning: node %ls 's child is null, please check your ndl/mel file.\n", nodePtr->NodeName().c_str()); + } + else + { + fstream << nodePtr->Inputs(i)->NodeName(); + } } } fstream.PutMarker(FileMarker::fileMarkerEndSection, L"ERelation"); @@ -566,6 +573,34 @@ namespace Microsoft { namespace MSR { namespace CNTK { } nodeToDelete->DetachInputs(); //nodeToDelete is a parent + auto search = std::find(m_labels.begin(), m_labels.end(), nodeToDelete); + if (search != m_labels.end()) + { + m_labels.erase(search); + } + search = std::find(m_features.begin(), m_features.end(), nodeToDelete); + if (search != m_features.end()) + { + m_features.erase(search); + } + search = std::find(m_finalCriteria.begin(), m_finalCriteria.end(), nodeToDelete); + if (search != m_finalCriteria.end()) + { + m_finalCriteria.erase(search); + } + search = std::find(m_evalNodes.begin(), m_evalNodes.end(), nodeToDelete); + if (search != m_evalNodes.end()) + { + m_evalNodes.erase(search); + } + + search = std::find(m_outputNodes.begin(), m_outputNodes.end(), nodeToDelete); + if (search != m_outputNodes.end()) + { + m_outputNodes.erase(search); + } + + // ? how to deal with m_recurrentInfo, when we delete a node. //delete the node itself m_nameToNodeMap.erase(nodeName); diff --git a/papers/CNTK-TechReport/figures/ConfusionData1.png b/papers/CNTK-TechReport/figures/ConfusionData1.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/figures/ConfusionData100.png b/papers/CNTK-TechReport/figures/ConfusionData100.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/figures/SimpleDemoDataReference.png b/papers/CNTK-TechReport/figures/SimpleDemoDataReference.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/figures/SimpleDemoErrorRateReference.png b/papers/CNTK-TechReport/figures/SimpleDemoErrorRateReference.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/figures/SimpleDemoOutputReference.png b/papers/CNTK-TechReport/figures/SimpleDemoOutputReference.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/figures/SpeechErrorRate.png b/papers/CNTK-TechReport/figures/SpeechErrorRate.png old mode 100644 new mode 100755 diff --git a/papers/CNTK-TechReport/lyx/CNTKBook_Introduction.lyx b/papers/CNTK-TechReport/lyx/CNTKBook_Introduction.lyx old mode 100644 new mode 100755