Skip to content

Commit

Permalink
Integrate mahilleb/ExpDnnWriteCommand into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Project Philly committed May 14, 2016
2 parents b09ba68 + 6c2d01b commit 658046d
Show file tree
Hide file tree
Showing 10 changed files with 2,567 additions and 5 deletions.
12 changes: 10 additions & 2 deletions Source/Readers/ExperimentalHTKMLFReader/ConfigHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,16 @@ size_t ConfigHelper::GetRandomizationWindow()

wstring ConfigHelper::GetRandomizer()
{
// get the read method, defaults to "blockRandomize"
wstring randomizer(m_config(L"readMethod", L"blockRandomize"));
// Check (on the action) if we're writing (inputs only) or training/evaluating (inputs and outputs)
bool isActionWrite = wstring(m_config(L"action", L"")) == L"write";

// Get the read method, defaults to "blockRandomize".
wstring randomizer = m_config(L"readMethod", L"blockRandomize");

if (isActionWrite && randomizer != L"none")
{
InvalidArgument("'readMethod' must be 'none' for write action.");
}

if (randomizer == L"blockRandomize" && GetRandomizationWindow() == randomizeNone)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Readers/ExperimentalHTKMLFReader/HTKMLFReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ std::vector<IDataDeserializerPtr> CreateDeserializers(const ConfigParameters& re
ConfigHelper config(readerConfig);

config.GetDataNamesFromConfig(featureNames, labelNames, notused, notused);
if (featureNames.size() < 1 || labelNames.size() < 1)
if (featureNames.size() < 1)
{
InvalidArgument("Network needs at least 1 feature and 1 label specified.");
InvalidArgument("Network needs at least 1 feature specified.");
}

CorpusDescriptorPtr corpus = std::make_shared<CorpusDescriptor>();
Expand Down
2 changes: 1 addition & 1 deletion Source/Readers/HTKMLFReader/HTKMLFReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ void HTKMLFReader<ElemType>::PrepareForTrainingOrTesting(const ConfigRecordType&
}

// Load all input and output data.
// Note that the terms features imply be real-valued quanities and
// Note that the terms features imply be real-valued quantities and
// labels imply categorical quantities, irrespective of whether they
// are inputs or targets for the network
// TODO: lots of code dup with the other Prepare function
Expand Down
1 change: 1 addition & 0 deletions Tests/EndToEndTests/Speech/DNN/WriteCommand/run-test
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if [ ! -e $OUTPUT_CURRENT ]; then
exit 3
fi

# Check for each line that the space-separated floats match the baseline with a tolerance of 0.03 %
OUTPUT_DIFF=$TEST_RUN_DIR/Output.ScaledLogLikelihood.diff
awk '{FS=" "} function abs(x) {return ((x < 0.0) ? -x : x)} NR==FNR {for (i=1; i<=NF; i++) a[FNR][i]=$i;} NR!=FNR {for (i=1; i<=NF; i++) {if ((abs($i - a[FNR][i])/abs($i)) > 0.03) printf("Line %d, Field %d: Baseline = %f, Current = %f\n", NR, i, a[FNR][i], $i);}}' $OUTPUT_BASELINE $OUTPUT_CURRENT > $OUTPUT_DIFF || exit $?

Expand Down
Loading

0 comments on commit 658046d

Please sign in to comment.