Added the ReleaseMatricesAfterBackprop function to sequence training node to release the temp matrices not needed after back propagation is complete for all the children of the nodes

This commit is contained in:
Amit Agarwal 2016-01-06 18:02:32 -08:00
Родитель 87206fc0bc
Коммит 40ce1afa4b
1 изменённых файлов: 10 добавлений и 0 удалений

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

@ -1367,6 +1367,16 @@ namespace Microsoft { namespace MSR { namespace CNTK {
RequestMatrixFromPool(m_softmaxOfRight, matrixPool);
RequestMatrixFromPool(m_gammaFromLattice, matrixPool);
}
// Release gradient and temp matrices that are no longer needed after all the children's gradients are computed.
virtual void ReleaseMatricesAfterBackprop(MatrixPool& matrixPool)
{
Base::ReleaseMatricesAfterBackprop(matrixPool);
ReleaseMatrixToPool(m_logSoftmaxOfRight, matrixPool);
ReleaseMatrixToPool(m_softmaxOfRight, matrixPool);
ReleaseMatrixToPool(m_gammaFromLattice, matrixPool);
}
// TODO: method names should be CamelCase
std::vector<shared_ptr<const msra::dbn::latticepair>> * getLatticePtr()
{