- DeppeStack: simplified upPass, downPass
This commit is contained in:
@@ -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 DeepStack::upPass(Layer *pLayer, arma::mat const &v)
|
||||||
{
|
{
|
||||||
arma::mat h = arma::zeros(0,0);
|
arma::mat h = v;
|
||||||
arma::mat tv = v;
|
|
||||||
while(pLayer)
|
while(pLayer)
|
||||||
{
|
{
|
||||||
if (pLayer->isEnable())
|
if (pLayer->isEnable())
|
||||||
{
|
{
|
||||||
h = pLayer->to_h_gibbs(tv);
|
h = pLayer->to_h_gibbs(h);
|
||||||
tv = h;
|
|
||||||
}
|
}
|
||||||
pLayer = pLayer->next;
|
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 DeepStack::downPass(Layer *pLayer, arma::mat const &h)
|
||||||
{
|
{
|
||||||
arma::mat v = arma::zeros(0,0);
|
arma::mat v = h;
|
||||||
arma::mat th = h;
|
|
||||||
while(pLayer)
|
while(pLayer)
|
||||||
{
|
{
|
||||||
if (pLayer->isEnable())
|
if (pLayer->isEnable())
|
||||||
{
|
{
|
||||||
v = pLayer->to_v_gibbs(th);
|
v = pLayer->to_v_gibbs(v);
|
||||||
th = v;
|
|
||||||
}
|
}
|
||||||
pLayer = pLayer->prev;
|
pLayer = pLayer->prev;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user