Skip to content

Commit

Permalink
Fix boundary setting when frameMode=true (For HTKMLFReader_linux); al…
Browse files Browse the repository at this point in the history
…so format the code.
  • Loading branch information
yzhang87 committed Jul 16, 2015
1 parent 0e65b1f commit 9bed897
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
10 changes: 5 additions & 5 deletions DataReader/HTKMLFReader/HTKMLFReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
}
}

m_framemode = readerConfig("frameMode", "true");
m_framemode = readerConfig("frameMode", "true");

int verbosity = readerConfig("verbosity","2");

Expand Down Expand Up @@ -1582,10 +1582,10 @@ namespace Microsoft { namespace MSR { namespace CNTK {
template<class ElemType>
void HTKMLFReader<ElemType>::SetSentenceSegBatch(Matrix<ElemType> &sentenceBegin, vector<MinibatchPackingFlag>& minibatchPackingFlag)
{
if (!m_framemode)
{
sentenceBegin.SetValue(m_sentenceBegin);
minibatchPackingFlag = m_minibatchPackingFlag;
if (!m_framemode)
{
sentenceBegin.SetValue(m_sentenceBegin);
minibatchPackingFlag = m_minibatchPackingFlag;
}
}

Expand Down
6 changes: 3 additions & 3 deletions DataReader/HTKMLFReader/HTKMLFReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HTKMLFReader : public IDataReader<ElemType>
vector<bool> m_sentenceEnd;
bool m_readAhead;
bool m_truncated;
bool m_framemode;
bool m_framemode;
vector<size_t> m_processedFrame;
intargvector m_numberOfuttsPerMinibatchForAllEpochs;
size_t m_numberOfuttsPerMinibatch;
Expand Down Expand Up @@ -121,7 +121,7 @@ class HTKMLFReader : public IDataReader<ElemType>
virtual bool DataEnd(EndDataType endDataType);
void SetSentenceSegBatch(Matrix<ElemType> &sentenceBegin, vector<MinibatchPackingFlag>& sentenceExistsBeginOrNoLabels);
void SetSentenceEnd(int /*actualMbSize*/){};
void SetRandomSeed(int){ NOT_IMPLEMENTED };
void SetRandomSeed(int){ NOT_IMPLEMENTED };
};

}}}
}}}
21 changes: 8 additions & 13 deletions DataReader/HTKMLFReader_linux/HTKMLFReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ namespace Microsoft { namespace MSR { namespace CNTK {
size_t iFeat, iLabel;
iFeat = iLabel = 0;
vector<wstring> statelistpaths;
bool framemode = true;
vector<size_t> numContextLeft;
vector<size_t> numContextRight;

Expand Down Expand Up @@ -261,14 +260,7 @@ namespace Microsoft { namespace MSR { namespace CNTK {
}
}

if (readerConfig.Exists("frameMode"))
{
const std::string& framemodeString = readerConfig("frameMode");
if (framemodeString == "false")
{
framemode = false;
}
}
m_framemode = readerConfig("frameMode", "true");

int verbosity = readerConfig("verbosity","2");

Expand Down Expand Up @@ -398,9 +390,9 @@ namespace Microsoft { namespace MSR { namespace CNTK {
m_lattices = new msra::dbn::latticesource(latticetocs, modelsymmap);

// now get the frame source. This has better randomization and doesn't create temp files
m_frameSource = new msra::dbn::minibatchutterancesourcemulti(infilesmulti, labelsmulti, m_featDims, m_labelDims, numContextLeft, numContextRight, randomize, *m_lattices, m_latticeMap, framemode);
m_frameSource = new msra::dbn::minibatchutterancesourcemulti(infilesmulti, labelsmulti, m_featDims, m_labelDims, numContextLeft, numContextRight, randomize, *m_lattices, m_latticeMap, m_framemode);
m_frameSource->setverbosity(verbosity);
//m_frameSource = new msra::dbn::minibatchutterancesource(infilesmulti[0], labelsmulti[0], m_featDims[0], m_labelDims[0], numContextLeft[0], numContextRight[0], randomize, *m_lattices, m_latticeMap, framemode);
//m_frameSource = new msra::dbn::minibatchutterancesource(infilesmulti[0], labelsmulti[0], m_featDims[0], m_labelDims[0], numContextLeft[0], numContextRight[0], randomize, *m_lattices, m_latticeMap, m_framemode);


}
Expand Down Expand Up @@ -1672,8 +1664,11 @@ the first row is 0/1 bit for wether corresponding frame has sentence beginining/
template<class ElemType>
void HTKMLFReader<ElemType>::SetSentenceSegBatch(Matrix<ElemType> &sentenceBegin, vector<MinibatchPackingFlag>& minibatchPackingFlag)
{
sentenceBegin.SetValue(m_sentenceBegin);
minibatchPackingFlag = m_minibatchPackingFlag;
if (!m_framemode)
{
sentenceBegin.SetValue(m_sentenceBegin);
minibatchPackingFlag = m_minibatchPackingFlag;
}
}


Expand Down
1 change: 1 addition & 0 deletions DataReader/HTKMLFReader_linux/HTKMLFReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class HTKMLFReader : public IDataReader<ElemType>
vector<bool> m_sentenceEnd;
bool m_readAhead;
bool m_truncated;
bool m_framemode;
vector<size_t> m_processedFrame;
intargvector m_numberOfuttsPerMinibatchForAllEpochs;
size_t m_numberOfuttsPerMinibatch;
Expand Down

0 comments on commit 9bed897

Please sign in to comment.