Set sentence begining by looking at the input sequence instead of output sequence. Ignore Sparse matrix in gradient check (to-do to fix this)

This commit is contained in:
kaisheny 2015-02-24 16:22:41 -08:00
Родитель 25cf8217bf
Коммит c9f7164ef6
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -1777,8 +1777,8 @@ bool BatchSequenceReader<ElemType>::GetMinibatch(std::map<std::wstring, Matrix<E
// vector of feature data goes into matrix column
size_t idx = (size_t)m_featureData[j];
//if (matrices.find(m_featuresName) != matrices.end())
features.SetValue(idx, j, (ElemType)1);
features.SetValue(idx, j, (ElemType)1);
SetSentenceBegin(idx, j, actualmbsize);
}
features.TransferFromDeviceToDevice(CPUDEVICE, featureDeviceId, false,false, false);
@ -1947,7 +1947,6 @@ void BatchSequenceReader<ElemType>::GetLabelOutput(std::map<std::wstring,
labels->SetValue(0, j, (ElemType)wrd);
SetSentenceEnd(wrd, j, actualmbsize);
SetSentenceBegin(wrd, j, actualmbsize);
if (class_size > 0)
{

Просмотреть файл

@ -1357,9 +1357,6 @@ protected:
irow = max(0, irow);
icol = max(0, icol);
if (node->GradientValues().GetMatrixType() == MatrixType::SPARSE)
continue;
fprintf(stderr, "\n###### d%ls######\n", node->NodeName().c_str());
// node->FunctionValues().Print();
ElemType eOrg = node->FunctionValues()(irow, icol);
@ -1368,6 +1365,10 @@ protected:
node->UpdateEvalTimeStamp();
net.ComputeGradient(criterionNodes[npos]); //use only the first criterion. Is
// if (node->GradientValues().GetMatrixType() == MatrixType::SPARSE && node->GradientValues().GetDeviceId() != CPUDEVICE)
if (node->GradientValues().GetMatrixType() == MatrixType::SPARSE)
break;
//ElemType mbEvalCri =
criterionNodes[npos]->FunctionValues().Get00Element(); //criterionNode should be a scalar
ElemType eGradErr = node->GradientValues()(irow, icol);