diff --git a/source/DeepStack.cpp b/source/DeepStack.cpp index 62f999e..40a63f9 100644 --- a/source/DeepStack.cpp +++ b/source/DeepStack.cpp @@ -87,14 +87,12 @@ arma::mat DeepStack::upDownPass(size_t layerId, const arma::mat& v) arma::mat DeepStack::upPass(Layer *pLayer, arma::mat const &v) { - arma::mat h = arma::zeros(0,0); - arma::mat tv = v; + arma::mat h = v; while(pLayer) { if (pLayer->isEnable()) { - h = pLayer->to_h_gibbs(tv); - tv = h; + h = pLayer->to_h_gibbs(h); } pLayer = pLayer->next; } @@ -103,14 +101,12 @@ arma::mat DeepStack::upPass(Layer *pLayer, arma::mat const &v) arma::mat DeepStack::downPass(Layer *pLayer, arma::mat const &h) { - arma::mat v = arma::zeros(0,0); - arma::mat th = h; + arma::mat v = h; while(pLayer) { if (pLayer->isEnable()) { - v = pLayer->to_v_gibbs(th); - th = v; + v = pLayer->to_v_gibbs(v); } pLayer = pLayer->prev; }