- refactored

- constify
This commit is contained in:
2024-01-22 12:26:03 +01:00
parent d99cf5ee4c
commit 938368f1fa
14 changed files with 102 additions and 99 deletions
+10 -10
View File
@@ -212,15 +212,15 @@ void RnnComponentLayer::onDraw(DrawComponent &obj)
{
if (&obj == DrawHidden)
{
m_stack.downPass(id(), obj.getData());
m_stack.downPass(this, obj.getData());
}
if (&obj == DrawVisibleTrain)
{
m_stack.upDownPass(id(), getTraining());
m_stack.upDownPass(this, getTraining());
}
if (&obj == DrawContextTrain)
{
m_stack.upDownPass(id(), getTraining());
m_stack.upDownPass(this, getTraining());
}
}
@@ -252,14 +252,14 @@ void RnnComponentLayer::buttonClicked(Button* buttonThatWasClicked)
else if (buttonThatWasClicked == m_buttonCopyH2C)
{
DrawContextTrain->getData() = DrawHidden->getData();
m_stack.upDownPass(id(), getTraining());
m_stack.upDownPass(this, getTraining());
}
}
void RnnComponentLayer::redrawReconstruction()
{
RnnComponentLayer *pComp = static_cast<RnnComponentLayer*> (root());
m_stack.upDownPass(pComp->id(), pComp->getTraining());
m_stack.upDownPass(pComp, pComp->getTraining());
}
arma::mat RnnComponentLayer::getTraining() const
@@ -272,7 +272,7 @@ arma::mat RnnComponentLayer::getReconst() const
return arma::join_rows(DrawVisibleReconst->getData(), DrawContextReconst->getData());
}
void RnnComponentLayer::trainRedraw(const arma::mat& vc)
void RnnComponentLayer::trainRedraw(const arma::mat& vc) const
{
DrawVisibleTrain->getData() = vc_to_v(vc);
DrawContextTrain->getData() = vc_to_c(vc);
@@ -280,7 +280,7 @@ void RnnComponentLayer::trainRedraw(const arma::mat& vc)
DrawContextTrain->DrawData();
}
void RnnComponentLayer::reconstRedraw(const arma::mat& vc)
void RnnComponentLayer::reconstRedraw(const arma::mat& vc) const
{
DrawVisibleReconst->getData() = vc_to_v(vc);
DrawContextReconst->getData() = vc_to_c(vc);
@@ -288,7 +288,7 @@ void RnnComponentLayer::reconstRedraw(const arma::mat& vc)
DrawContextReconst->DrawData();
}
void RnnComponentLayer::onUpPass(const arma::mat& v)
void RnnComponentLayer::onUpPass(const arma::mat& v) const
{
DrawVisibleTrain->getData() = vc_to_v(v);
DrawVisibleTrain->DrawData();
@@ -297,7 +297,7 @@ void RnnComponentLayer::onUpPass(const arma::mat& v)
trainRedraw(v);
}
void RnnComponentLayer::onDownPass(const arma::mat& h)
void RnnComponentLayer::onDownPass(const arma::mat& h) const
{
DrawHidden->getData() = h;
DrawHidden->DrawData();
@@ -334,7 +334,7 @@ void RnnComponentLayer::redrawWeights(size_t index)
void RnnComponentLayer::setTrainingData(arma::mat const& batch)
{
RnnComponentLayer *pComp = static_cast<RnnComponentLayer*> (root());
m_stack.upDownPass(id(), batch);
m_stack.upDownPass(this, batch);
}
//[/MiscUserCode]