Skip to content

Commit

Permalink
removed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
frankseide committed Jan 22, 2016
1 parent a4cf445 commit 7f07161
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Source/CNTK/SynchronousExecutionEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion Source/CNTK/SynchronousExecutionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SynchronousNodeEvaluator : public NDLNodeEvaluator<ElemType>
// 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".
Expand Down
16 changes: 8 additions & 8 deletions Source/CNTK/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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));
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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"));
Expand All @@ -498,7 +498,7 @@ void TestCommandLine(const ConfigParameters& configBase)
arrayQuotedStrings = dictQuotedStrings("files");
const char* mapping = dictQuotedStrings("mapping");
mapping;
//
//
// #super nesting
// dictNested=[
// array={
Expand Down
6 changes: 3 additions & 3 deletions Source/Common/DataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Common/Include/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class ConfigParser
{
// 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];
Expand Down Expand Up @@ -508,7 +508,7 @@ class ConfigParser
// (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.
Expand Down
2 changes: 1 addition & 1 deletion Source/Common/Include/Sequences.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ struct MBLayout
// 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
Expand Down
4 changes: 2 additions & 2 deletions Source/Common/Include/fileutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions Source/Common/fileutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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.
// ----------------------------------------------------------------------------

Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions Source/ComputationNetworkLib/ComputationNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb

// -----------------------------------------------------------------------
// 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.
Expand Down Expand Up @@ -857,12 +857,12 @@ class ComputationNetwork : public ScriptableObjects::Object, public ScriptableOb

// -----------------------------------------------------------------------
// 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.
// -----------------------------------------------------------------------

Expand Down
10 changes: 5 additions & 5 deletions Source/ComputationNetworkLib/ComputationNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class ComputationNodeBase : public IComputationNode,
// 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
Expand All @@ -335,9 +335,9 @@ class ComputationNodeBase : public IComputationNode,
// - 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.
Expand All @@ -353,9 +353,9 @@ class ComputationNodeBase : public IComputationNode,
// - 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().
Expand Down
4 changes: 2 additions & 2 deletions Source/ComputationNetworkLib/ReshapingNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ReinterpretNodeBase : public ComputationNode<ElemType>, public NumInputs<1
// input: T=2, D=2, K=3, S=2 (abcdef and uvwxyz)
// abc def
// ABC DEF
//
//
// uvw xyz
// UVW XYZ
// target:
Expand All @@ -59,7 +59,7 @@ class ReinterpretNodeBase : public ComputationNode<ElemType>, public NumInputs<1
// B E
// c f
// C F
//
//
// u x
// U X
// v y
Expand Down
8 changes: 4 additions & 4 deletions Source/ComputationNetworkLib/TrainingNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
6 changes: 3 additions & 3 deletions Source/Math/CPUMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,15 @@ 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++)
{
memcpy(&us(startRowIndeces[i], j), &(*inputMatrices[i])(0, sliceStartCol+j), inputMatrices[i]->GetNumRows() * sizeof(ElemType));
}
}

delete [] startRowIndeces;

return *this;
Expand Down Expand Up @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions Source/Math/GPUMatrix.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Source/Math/GPUMatrixCUDAKernels.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ __global__ void _assignNumOfDiff(
}

/*template<class ElemType>
__global__ void _assignNumOfDiff(
__global__ void _assignNumOfDiff(
ElemType *a,
ElemType *b,
ElemType *c,
Expand Down Expand Up @@ -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])));
}
}
*/
Expand Down
2 changes: 1 addition & 1 deletion Source/Math/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 5 additions & 5 deletions Source/Math/latticefunctionskernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 7f07161

Please sign in to comment.