removed trailing spaces
This commit is contained in:
Родитель
a4cf44544a
Коммит
7f07161ccd
|
@ -186,7 +186,7 @@ void SynchronousNodeEvaluator<ElemType>::Evaluate(NDLNode<ElemType>* node, const
|
|||
wstring initString = node->GetOptionalParameter("init", "uniform");
|
||||
ElemType initValueScale = node->GetOptionalParameter("initValueScale", "1");
|
||||
ElemType value = node->GetOptionalParameter("value", "0");
|
||||
|
||||
|
||||
if (!_wcsicmp(initString.c_str(), L"fixedValue"))
|
||||
nodePtr->Value().SetValue(value);
|
||||
else if (!_wcsicmp(initString.c_str(), L"uniform"))
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
// A=MacroCall3(...)
|
||||
// D=Times(A.B,X.B)}
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
// In this example, in the call D=Times(A.B,X.B), we need to resolve A.B and X.B appropriately.
|
||||
// Specifically, "A.B" must be resolved to the fully qualified name "C.A.B", whereas "X.B" must be resolved to the fully qualified name "P.B".
|
||||
|
|
|
@ -41,9 +41,9 @@ void TestBing(const ConfigParameters& config)
|
|||
DataReader<ElemType> dataReader(vdim, udim, filepaths, config);
|
||||
ConfigArray layerSizes(config("networkDescription"));
|
||||
SimpleNetworkBuilder<ElemType> netBuilder(layerSizes, TrainingCriterion::SquareError, EvalCriterion::SquareError, L"Sigmoid", true, false, false, &dataReader);
|
||||
|
||||
|
||||
ConfigArray learnRatesPerMB(config("learnRatesPerMB"));
|
||||
|
||||
ConfigArray learnRatesPerMB(config("learnRatesPerMB"));
|
||||
ConfigArray mbSize(config("mbSize"));
|
||||
size_t epochSize = config("epochSize");
|
||||
size_t maxEpochs = config("maxEpochs");
|
||||
|
@ -52,16 +52,16 @@ void TestBing(const ConfigParameters& config)
|
|||
wstring modelPath = wstring(msra::strfun::utf16(outDir)).append(L"\\bingranknet.dnn");
|
||||
|
||||
SimpleSGD<ElemType> sgd(learnRatesPerMB, mbSize, epochSize, maxEpochs, modelPath, momentumPerMB);
|
||||
sgd.Train(netBuilder, dataReader, true);
|
||||
sgd.Train(netBuilder, dataReader, true);
|
||||
|
||||
std::cout<<std::endl<<std::endl<<std::endl<<std::endl<<"Testing ..... "<<std::endl;
|
||||
|
||||
// test
|
||||
vector<wstring> testfilepaths;
|
||||
testfilepaths.push_back( config("test.set"));
|
||||
testfilepaths.push_back( config("test.set"));
|
||||
size_t testSize = config("test.set.size");
|
||||
DataReader<ElemType> testDataReader(vdim, udim, testfilepaths, config);
|
||||
|
||||
|
||||
wstring finalNetPath = modelPath.append(L".").append(to_wstring(maxEpochs-1));
|
||||
|
||||
SimpleEvaluator<ElemType> eval(netBuilder.LoadNetworkFromFile(finalNetPath, false));
|
||||
|
@ -433,7 +433,7 @@ void TestCommandLine(const ConfigParameters& configBase)
|
|||
wstr = (std::wstring) unicodeTests("nothere", L"defWstring");
|
||||
// wstringQuotes="東京に行きましょう. 明日"
|
||||
std::wstring wstrQuotes = unicodeTests("wstringQuotes");
|
||||
//
|
||||
//
|
||||
// #array tests
|
||||
// arrayEmpty={}
|
||||
ConfigArray arrayEmpty = arrayTests("arrayEmpty");
|
||||
|
@ -474,7 +474,7 @@ void TestCommandLine(const ConfigParameters& configBase)
|
|||
ConfigArray array3 = arrayNested[2];
|
||||
name = array3.Name();
|
||||
ConfigArray array4 = arrayNested[3];
|
||||
//
|
||||
//
|
||||
// #dictionary tests
|
||||
// dictEmpty=[]
|
||||
ConfigParameters dictEmpty(dictTests("dictEmpty"));
|
||||
|
@ -498,7 +498,7 @@ void TestCommandLine(const ConfigParameters& configBase)
|
|||
arrayQuotedStrings = dictQuotedStrings("files");
|
||||
const char* mapping = dictQuotedStrings("mapping");
|
||||
mapping;
|
||||
//
|
||||
//
|
||||
// #super nesting
|
||||
// dictNested=[
|
||||
// array={
|
||||
|
|
|
@ -177,11 +177,11 @@ bool DataReader<ElemType>::GetMinibatch(std::map<std::wstring, Matrix<ElemType>*
|
|||
/**
|
||||
each reader reads data with number of columns as nbr_utterances_per_minibatch * mbSize
|
||||
notice that readers may differ in their actual mbsize, though it is supposedly to be nbr_utterances_per_minibatch * mbSize.
|
||||
To handle with this, readers use their getminibatch function and then return their exact number of utterance in each minbatch.
|
||||
This exact number, which is specified for the next reader, is passed to the next reader.
|
||||
To handle with this, readers use their getminibatch function and then return their exact number of utterance in each minbatch.
|
||||
This exact number, which is specified for the next reader, is passed to the next reader.
|
||||
The next reader then returns the exact number of utterances per minibatch, after calling its getminibatch function.
|
||||
Then this returned number is compared against the specified number. If these two numbers are not consistent, return with logic error.
|
||||
The logic error can be avoided usually with an exchange of reading orders.
|
||||
The logic error can be avoided usually with an exchange of reading orders.
|
||||
*/
|
||||
for (size_t i = 0; i < m_ioNames.size(); i++)
|
||||
{
|
||||
|
|
|
@ -391,7 +391,7 @@ public:
|
|||
{
|
||||
// look for closing brace and also for another opening brace
|
||||
// Inside strings we only accept the closing quote, and ignore any braces inside.
|
||||
current = str.find_first_of(braceStack.back() == '"' ? "\"" : charsToLookFor, current + 1); //
|
||||
current = str.find_first_of(braceStack.back() == '"' ? "\"" : charsToLookFor, current + 1); //
|
||||
if (current == string::npos) // none found: done or error
|
||||
break;
|
||||
char brace = str[current];
|
||||
|
@ -508,7 +508,7 @@ public:
|
|||
// (12:45:23:46)
|
||||
// However if you are using strings, and one of those strings contains a ‘:’, you might want to change the separator to something else:
|
||||
// (;this;is;a;path:;c:\mydir\stuff)
|
||||
//
|
||||
//
|
||||
// This will fail for
|
||||
// (..\dirname,something else)
|
||||
// Hence there is an ugly fix for it below. This will go away when we replace all configuration parsing by BrainScript.
|
||||
|
|
|
@ -396,7 +396,7 @@ private:
|
|||
// Lookup tables for determining whether any sequence at time t is a boundary or gap.
|
||||
// An optional time delay can be given, then the test is whether going from t to (t + time delay) crosses a boundary.
|
||||
// The purpose is for knowing when to reset state of a recurrent node.
|
||||
//
|
||||
//
|
||||
// For every (s,t), we store the distance to the corresponding sequence begin and end.
|
||||
// We also store for every [t] an aggregate to know the nearest boundary.
|
||||
// For example, two sentences used in parallel, one with 5 and one with 3 time steps, in one minibatch, both starting at step 0
|
||||
|
|
|
@ -449,11 +449,11 @@ const wchar_t* GetFormatString(T /*t*/)
|
|||
// for example:
|
||||
// File& operator>>(File& stream, MyClass& test);
|
||||
// File& operator<<(File& stream, MyClass& test);
|
||||
//
|
||||
//
|
||||
// in your class you will probably want to add these functions as friends so you can access any private members
|
||||
// friend File& operator>>(File& stream, MyClass& test);
|
||||
// friend File& operator<<(File& stream, MyClass& test);
|
||||
//
|
||||
//
|
||||
// if you are using wchar_t* or char* types, these use other methods because they require buffers to be passed
|
||||
// either use std::string and std::wstring, or use the WriteString() and ReadString() methods
|
||||
assert(false); // need a specialization
|
||||
|
|
|
@ -933,12 +933,12 @@ wstring fgetwstring(FILE* f)
|
|||
wstring res;
|
||||
for (;;)
|
||||
{
|
||||
//
|
||||
//
|
||||
// there is a known vc++ runtime bug: Microsoft Connect 768113
|
||||
// fgetwc can skip a byte in certain condition
|
||||
// this is already fixed in update release to VS 2012
|
||||
// for now the workaround is to use fgetc twice to simulate fgetwc
|
||||
//
|
||||
//
|
||||
// wint_t c = fgetwc (f);
|
||||
int c1 = fgetc(f);
|
||||
int c2 = fgetc(f);
|
||||
|
@ -1566,7 +1566,7 @@ static short toolULawToLinear(unsigned char p_ucULawByte)
|
|||
nExponent=(p_ucULawByte >> 4) & 0x07;
|
||||
nMantissa=p_ucULawByte & 0x0F;
|
||||
nSample=anExpLut[nExponent]+(nMantissa<<(nExponent+3));
|
||||
if(nSign != 0)
|
||||
if(nSign != 0)
|
||||
nSample = -nSample;
|
||||
|
||||
return nSample;
|
||||
|
@ -1620,11 +1620,11 @@ void fgetwav (FILE * f, std::vector<short> & wav, int & sampleRate)
|
|||
}
|
||||
else if (wavhd.nChannels == 2)
|
||||
{
|
||||
// read raw data
|
||||
// read raw data
|
||||
std::vector<short> buf;
|
||||
buf.resize(numSamples * 2);
|
||||
fgetwavraw(f, buf, wavhd);
|
||||
|
||||
|
||||
// map to mono
|
||||
wav.resize (numSamples);
|
||||
const short * p = &buf[0];
|
||||
|
@ -1652,8 +1652,8 @@ void fgetwav (const wstring & fn, std::vector<short> & wav, int & sampleRate)
|
|||
// ... TODO:
|
||||
// - rename this function!!
|
||||
// - also change to read header itself and return sample rate and channels
|
||||
// fgetraw(): read data of multi-channel .wav file, and separate data of multiple channels.
|
||||
// For example, data[i][j]: i is channel index, 0 means the first
|
||||
// fgetraw(): read data of multi-channel .wav file, and separate data of multiple channels.
|
||||
// For example, data[i][j]: i is channel index, 0 means the first
|
||||
// channel. j is sample index.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
@ -1716,7 +1716,7 @@ void fputwfx (FILE *f, const WAVEFORMATEX & wfx, unsigned int numSamples)
|
|||
(DataLength / wfx.nBlockAlign == numSamples)
|
||||
|| RuntimeError ("fputwfx: data size exceeds WAV header 32-bit range");
|
||||
unsigned int RiffLength = 36 + DataLength;
|
||||
unsigned int FmtLength = 16;
|
||||
unsigned int FmtLength = 16;
|
||||
// file header
|
||||
assert (wfx.cbSize == 0 || wfx.cbSize == FmtLength + 2);
|
||||
fputTag (f, "RIFF");
|
||||
|
|
|
@ -805,7 +805,7 @@ protected:
|
|||
|
||||
// -----------------------------------------------------------------------
|
||||
// SEQTraversalFlowControlNode -- FlowControlNode to traverse a (sub-)network time step by time step
|
||||
//
|
||||
//
|
||||
// This is to implement recurrent loops. All nodes inside a loop are listed
|
||||
// inside this node. This node's ForwardProp() function will execute
|
||||
// them inside a loop over all time steps of the recurrence.
|
||||
|
@ -857,12 +857,12 @@ protected:
|
|||
|
||||
// -----------------------------------------------------------------------
|
||||
// PARTraversalFlowControlNode -- FlowControlNode that traverses a (sub-)network
|
||||
//
|
||||
//
|
||||
// This node contains a list of nodes in a (sub-)network. This node's
|
||||
// ForwardProp() method will execute all those nodes once in PAR mode,
|
||||
// that is, by passing a FrameRange object that represents to operate
|
||||
// on all frames in the node simultaneously.
|
||||
//
|
||||
//
|
||||
// The outermost network level is also represented by this node for execution.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
// dimensions
|
||||
|
||||
// The value of a node is a tensor in one of two variants:
|
||||
//
|
||||
//
|
||||
// - single matrix, vector, tensor
|
||||
// - m_sampleLayout contains the shape. Accessed through GetSampleLayout().
|
||||
// - m_pMBLayout is null
|
||||
|
@ -335,9 +335,9 @@ public:
|
|||
// - m_sampleLayout is the tensor shape of the samples
|
||||
// - m_pMBLayout defines the number of time steps and parallel sequences (="tensor shape" of the minibatch)
|
||||
// Accessed through GetMBLayout(); test for through HasMBLayout().
|
||||
//
|
||||
//
|
||||
// The values can be accessed in three ways:
|
||||
//
|
||||
//
|
||||
// - as a tensor
|
||||
// - GetTensorShape() forms the joint tensor that incorporates both m_sampleLayout and, if present, m_pMBLayout
|
||||
// - Elementwise tensor operations operate on these.
|
||||
|
@ -353,9 +353,9 @@ public:
|
|||
// - actual object is a 2D tensor without MB Layout
|
||||
// - ValueAsMatrix(), GradientAsMatrix() returns tensor as a 2D Matrix object
|
||||
// - nodes that do this are: TimesNode, DiagTimesNode, ConvolutionNode, NoiseContrastiveEstimationNode, ClassBasedCrossEntropyWithSoftmaxNode, TransposeNode, DiagonalNode
|
||||
//
|
||||
//
|
||||
// How values are stored:
|
||||
//
|
||||
//
|
||||
// - minibatch: Matrix of columns, where each column is a sample
|
||||
// - tensor: Matrix where column dimension contains all but the first dimension
|
||||
// - This only matters for sparse matrices, which cannot easily be Reshaped().
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
// input: T=2, D=2, K=3, S=2 (abcdef and uvwxyz)
|
||||
// abc def
|
||||
// ABC DEF
|
||||
//
|
||||
//
|
||||
// uvw xyz
|
||||
// UVW XYZ
|
||||
// target:
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
// B E
|
||||
// c f
|
||||
// C F
|
||||
//
|
||||
//
|
||||
// u x
|
||||
// U X
|
||||
// v y
|
||||
|
|
|
@ -1027,17 +1027,17 @@ template class ClassBasedCrossEntropyWithSoftmaxNode<double>;
|
|||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
CRF training criterion
|
||||
It uses forward-backward algorithm within a minibatch to compute statistics for sequence level optimization
|
||||
CRF training criterion
|
||||
It uses forward-backward algorithm within a minibatch to compute statistics for sequence level optimization
|
||||
This node can serve a base class for other sequence level optimization
|
||||
|
||||
Developed by Kaisheng Yao
|
||||
This node is for replicating results of the following work
|
||||
K. Yao, B. Peng, G. Zweig, D. Yu, X. Li and F. Gao, "Recurrent Conditional Random Fields", NIPS Deep Learning Workshop 2014
|
||||
K. Yao, B. Peng, G. Zweig, D. Yu, X. Li and F. Gao, "Recurrent Conditional Random Fields for Language Understanding", ICASSP 2014
|
||||
K. Yao, B. Peng, G. Zweig, D. Yu, X. Li and F. Gao, "Recurrent Conditional Random Fields for Language Understanding", ICASSP 2014
|
||||
http://research.microsoft.com/pubs/210167/rcrf_v9.pdf
|
||||
|
||||
The forward-backward algorithm follows the derivation in
|
||||
The forward-backward algorithm follows the derivation in
|
||||
http://jmlr.org/papers/volume12/collobert11a/collobert11a.pdf
|
||||
|
||||
*/
|
||||
|
|
|
@ -555,7 +555,7 @@ CPUMatrix<ElemType> CPUMatrix<ElemType>::Diagonal() const
|
|||
|
||||
auto& us = *this;
|
||||
|
||||
#pragma omp parallel for
|
||||
#pragma omp parallel for
|
||||
for (long j = 0; j<sliceNumCols; j++)
|
||||
{
|
||||
for (int i = 0; i < inputMatrices.size(); i++)
|
||||
|
@ -563,7 +563,7 @@ CPUMatrix<ElemType> CPUMatrix<ElemType>::Diagonal() const
|
|||
memcpy(&us(startRowIndeces[i], j), &(*inputMatrices[i])(0, sliceStartCol+j), inputMatrices[i]->GetNumRows() * sizeof(ElemType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
delete [] startRowIndeces;
|
||||
|
||||
return *this;
|
||||
|
@ -4127,7 +4127,7 @@ void CPUMatrix<ElemType>::Multiply1x1AndWeightedAdd(ElemType alpha, const CPUMat
|
|||
c(i, j) = b(i, j) * f + c(i, j) * beta;
|
||||
}
|
||||
|
||||
/* compute singular value decomposition as
|
||||
/* compute singular value decomposition as
|
||||
A = U*SIGMA*VT
|
||||
W is used as temp working memory
|
||||
*/
|
||||
|
|
|
@ -899,7 +899,7 @@ GPUMatrix<ElemType> GPUMatrix<ElemType>::Diagonal() const
|
|||
size_t* startRowIndeces = new size_t[inputMatrices.size()+1];
|
||||
ElemType ** bufferPointersInInputMatrices = new ElemType*[inputMatrices.size()];
|
||||
|
||||
startRowIndeces[0] = 0;
|
||||
startRowIndeces[0] = 0;
|
||||
|
||||
for (int i = 0; i < inputMatrices.size(); i++)
|
||||
{
|
||||
|
@ -3302,7 +3302,7 @@ void GPUMatrix<ElemType>::VectorMin(GPUMatrix<ElemType>& minIndexes, GPUMatrix<E
|
|||
_vectorMaxMinReduce<ElemType, false><<<blocksPerGrid, GridDim::maxThreadsPerBlock, 0, t_stream>>>(us.m_pArray, minIndexes.m_pArray, minValues.m_pArray, m, n);
|
||||
|
||||
/*
|
||||
int blocksPerGrid=(int)ceil(1.0*n/GridDim::maxThreadsPerBlock);
|
||||
int blocksPerGrid=(int)ceil(1.0*n/GridDim::maxThreadsPerBlock);
|
||||
_vectorMin<ElemType><<<blocksPerGrid,GridDim::maxThreadsPerBlock,0,t_stream>>>(us.m_pArray,minIndexes.m_pArray,minValues.m_pArray,m,n,isColWise);*/
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2686,7 +2686,7 @@ __global__ void _assignNumOfDiff(
|
|||
}
|
||||
|
||||
/*template<class ElemType>
|
||||
__global__ void _assignNumOfDiff(
|
||||
__global__ void _assignNumOfDiff(
|
||||
ElemType *a,
|
||||
ElemType *b,
|
||||
ElemType *c,
|
||||
|
@ -4430,11 +4430,11 @@ ElemType* d_tmp)
|
|||
{
|
||||
if (sizeof(ElemType)==sizeof(float))
|
||||
{
|
||||
d_tmp[0] = max((ElemType)0, d_tmp[0]/max((ElemType)1.0e-10,sqrtf(d_tmp[1]))/max((ElemType)1.0e-10,sqrtf(d_tmp[2])));
|
||||
d_tmp[0] = max((ElemType)0, d_tmp[0]/max((ElemType)1.0e-10,sqrtf(d_tmp[1]))/max((ElemType)1.0e-10,sqrtf(d_tmp[2])));
|
||||
}
|
||||
else
|
||||
{
|
||||
d_tmp[0] = max((ElemType)0, d_tmp[0]/max((ElemType)1.0e-10,sqrt(d_tmp[1]))/max((ElemType)1.0e-10,sqrt(d_tmp[2])));
|
||||
d_tmp[0] = max((ElemType)0, d_tmp[0]/max((ElemType)1.0e-10,sqrt(d_tmp[1]))/max((ElemType)1.0e-10,sqrt(d_tmp[2])));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -746,7 +746,7 @@ Matrix<ElemType> Matrix<ElemType>::ColumnSlice(size_t startColumn, size_t numCol
|
|||
{
|
||||
int devId = GetDeviceId();
|
||||
|
||||
Matrix<ElemType> slice(matrixFlagDontOwnBuffer, (DEVICEID_TYPE) devId); //
|
||||
Matrix<ElemType> slice(matrixFlagDontOwnBuffer, (DEVICEID_TYPE) devId); //
|
||||
|
||||
slice.m_preferredDeviceId = m_preferredDeviceId;
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ struct latticefunctionskernels
|
|||
// zhaorui
|
||||
static inline __device__ float getlogtransp(lr3transP transP, int from, int to)
|
||||
{
|
||||
/*if (from < -1 || from >= transP.MAXSTATES || to > transP.MAXSTATES)
|
||||
/*if (from < -1 || from >= transP.MAXSTATES || to > transP.MAXSTATES)
|
||||
{
|
||||
// printf("from: %d to: %d\n", from, to);
|
||||
return LOGZERO;
|
||||
|
@ -420,13 +420,13 @@ struct latticefunctionskernels
|
|||
{
|
||||
/* if (isSil) // for sil, -1 to 2 and -1 to 0 is permitted
|
||||
{
|
||||
pathscore0 += getlogtransp(transP,-1,0) + logLLs(senoneid0,ts);
|
||||
pathscore2 += getlogtransp(transP,-1,2) + logLLs(senoneid2,ts);
|
||||
pathscore0 += getlogtransp(transP,-1,0) + logLLs(senoneid0,ts);
|
||||
pathscore2 += getlogtransp(transP,-1,2) + logLLs(senoneid2,ts);
|
||||
}
|
||||
else // for others, only -1 to 0 is permitted
|
||||
{
|
||||
pathscore0 += getlogtransp(transP, -1, 0) + logLLs(senoneid0, ts);
|
||||
pathscore1 += getlogtransp(transP, -1, 1) + logLLs(senoneid1, ts);
|
||||
pathscore0 += getlogtransp(transP, -1, 0) + logLLs(senoneid0, ts);
|
||||
pathscore1 += getlogtransp(transP, -1, 1) + logLLs(senoneid1, ts);
|
||||
|
||||
}*/
|
||||
pathscore2 += getlogtransp(transP, -1, 2) + logLLs(senoneid2, ts);
|
||||
|
|
|
@ -86,7 +86,7 @@ struct SectionHeader
|
|||
WORD writtenID; // unique ID so files written at the same time can be identified
|
||||
WORD unusedWords[5];
|
||||
size_t elementsCount; // number of total elements stored
|
||||
// * section specific data goes below here * //
|
||||
// * section specific data goes below here * //
|
||||
WORD labelKind; // kind of label (LabelKind type)
|
||||
WORD labelDim; // number of possible states for labels (category type)
|
||||
char unused[descriptionSize - 18 * sizeof(WORD) - sizeof(size_t)]; // space for future expansion (zero out in current versions)
|
||||
|
@ -560,7 +560,7 @@ private:
|
|||
vector<SectionFile*> m_secFiles;
|
||||
std::map<std::wstring, Section*, nocase_compare> m_sections;
|
||||
|
||||
/**
|
||||
/**
|
||||
for reading one line per file, i.e., a file has only one line of data
|
||||
*/
|
||||
bool mOneLinePerFile;
|
||||
|
|
|
@ -381,7 +381,7 @@ bool DSSMReader<ElemType>::GetMinibatch(std::map<std::wstring, Matrix<ElemType>*
|
|||
featuresQ.TransferFromDeviceToDevice(featuresQ.GetDeviceId(), -1);
|
||||
featuresQ.SwitchToMatrixType(MatrixType::DENSE, MatrixFormat::matrixFormatDense);
|
||||
featuresQ.Print("featuresQ");
|
||||
|
||||
|
||||
featuresD.TransferFromDeviceToDevice(featuresD.GetDeviceId(), -1);
|
||||
featuresD.SwitchToMatrixType(MatrixType::DENSE, MatrixFormat::matrixFormatDense);
|
||||
featuresD.Print("featuresD");
|
||||
|
|
|
@ -2332,7 +2332,7 @@ public:
|
|||
|
||||
// estimate
|
||||
vector<bool> dropWord (userSymMap.size(), false);
|
||||
dropWord.push_back (true); // filtering but no <UNK>:
|
||||
dropWord.push_back (true); // filtering but no <UNK>:
|
||||
assert (!filterVocabulary || unkId != -1 || dropWord[dropId]);
|
||||
|
||||
// std::vector<unsigned int> minObs (2, 0);
|
||||
|
|
|
@ -68,9 +68,9 @@ class biggrowablevectorarray : public growablevectorbase<msra::dbn::matrix>
|
|||
fclose(ftry);
|
||||
}
|
||||
|
||||
/*
|
||||
code below to cycle through a-z appended to file name is no longer necessary
|
||||
since caller guarantees unique file names via HTKMLFReader
|
||||
/*
|
||||
code below to cycle through a-z appended to file name is no longer necessary
|
||||
since caller guarantees unique file names via HTKMLFReader
|
||||
and we want the pagepath logged to the user to be the actual one used by the code
|
||||
|
||||
// try to open the pagepath from a to z
|
||||
|
|
|
@ -723,7 +723,7 @@ private:
|
|||
RuntimeError("randomshuffle: too large set: need to change to different random generator!");
|
||||
}
|
||||
srand ((unsigned int) randomseed);
|
||||
|
||||
|
||||
foreach_index (i, v[0])
|
||||
{
|
||||
// pick a random location
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
// - lattices are returned as a shared_ptr
|
||||
// Thus, getbatch() can be called in a thread-safe fashion, allowing for a 'minibatchsource' implementation that wraps another with a read-ahead thread.
|
||||
// Return value is 'true' if it did read anything from disk, and 'false' if data came only from RAM cache. This is used for controlling the read-ahead thread.
|
||||
//
|
||||
//
|
||||
// This version introduces <utteranceinfo>, which contains the utterance ID
|
||||
// information for each frame in the minibatch. Ideally we would like to
|
||||
// call it as <uids>, but that is already taken by the labels... If the
|
||||
|
|
|
@ -62,9 +62,9 @@ class biggrowablevectorarray : public growablevectorbase<msra::dbn::matrix>
|
|||
fclose(ftry);
|
||||
}
|
||||
|
||||
/*
|
||||
code below to cycle through a-z appended to file name is no longer necessary
|
||||
since caller guarantees unique file names via HTKMLFReader
|
||||
/*
|
||||
code below to cycle through a-z appended to file name is no longer necessary
|
||||
since caller guarantees unique file names via HTKMLFReader
|
||||
and we want the pagepath logged to the user to be the actual one used by the code
|
||||
|
||||
// try to open the pagepath from a to z
|
||||
|
|
|
@ -723,7 +723,7 @@ private:
|
|||
throw std::runtime_error ("randomshuffle: too large set: need to change to different random generator!");
|
||||
}
|
||||
srand ((unsigned int) randomseed);
|
||||
|
||||
|
||||
foreach_index (i, v[0])
|
||||
{
|
||||
// pick a random location
|
||||
|
@ -1197,8 +1197,8 @@ public:
|
|||
// We specify the utterance by its global start time (in a space of a infinitely repeated training set).
|
||||
// This is efficient since getbatch() is called with sequential 'globalts' except at epoch start.
|
||||
// Note that the start of an epoch does not necessarily fall onto an utterance boundary. The caller must use firstvalidglobalts() to find the first valid globalts at or after a given time.
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
/*implement*/ bool getbatch(const size_t globalts, const size_t framesrequested, std::vector<msra::dbn::matrix> &feat,
|
||||
std::vector<std::vector<size_t>> &uids, std::vector<std::pair<wstring, size_t>> &utteranceinfo,
|
||||
std::vector<const_array_ref<msra::lattices::lattice::htkmlfwordsequence::word>> &transcripts,
|
||||
|
|
|
@ -213,7 +213,7 @@ bool SequenceReader<ElemType>::EnsureDataAvailable(size_t mbStartSample, bool /*
|
|||
// this has to be an even number, a pair of index and value
|
||||
if ((spos.numberPos&1) != 0)
|
||||
RuntimeError("Features must be specified in pairs (index:value). Invalid features for label '%s'\n", labelValue);
|
||||
|
||||
|
||||
while (feature < spos.numberPos)
|
||||
{
|
||||
int index = (int)featureTemp[feature++];
|
||||
|
|
|
@ -1248,7 +1248,7 @@ size_t SGD<ElemType>::TrainOneEpoch(ComputationNetworkPtr net,
|
|||
// Initializes the model from original model.
|
||||
// TODO: Comment what this does!
|
||||
auto origNet = make_shared<ComputationNetwork>(deviceId);
|
||||
ComputationNetworkPtr sequenceNet =
|
||||
ComputationNetworkPtr sequenceNet =
|
||||
(startEpoch < 0) ? netBuilder->BuildNetworkFromDescription() : origNet;
|
||||
std::vector<ComputationNodeBasePtr> addedFeatureNodes;
|
||||
std::vector<ComputationNodeBasePtr> replacedCriterionNodes;
|
||||
|
|
|
@ -890,8 +890,8 @@ void lattice::parallelsMBRerrorsignal(parallelstate& parallelstate, const edgeal
|
|||
const double logEframescorrecttotal, msra::math::ssematrixbase& errorsignal, msra::math::ssematrixbase& errorsignalneg) const
|
||||
{
|
||||
/* time measurement for CUDA
|
||||
cudaerrorcopyto: 3.058592 ms
|
||||
cudaerrorsignalsync: 0.356998 ms
|
||||
cudaerrorcopyto: 3.058592 ms
|
||||
cudaerrorsignalsync: 0.356998 ms
|
||||
cudaerrorcopyback: 8.983703 ms */
|
||||
|
||||
/* time measurement for emulation
|
||||
|
|
Загрузка…
Ссылка в новой задаче