From d5a64f6e6b5dc3acddf8652427936c6f9965bca1 Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 21 Jan 2024 15:25:50 +0100 Subject: [PATCH] - DeppeStack: simplified upPass, downPass --- source/DeepStack.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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; }