- DeppeStack: simplified upPass, downPass

This commit is contained in:
2024-01-21 15:25:50 +01:00
parent 5a963d805f
commit d5a64f6e6b
+4 -8
View File
@@ -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;
}