- poet use AStack::weightsInit

- AStack::weightsSave continue for other layer on failure 

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@854 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-01-21 06:28:39 +00:00
parent 02b40561ec
commit c10d9c6e38
2 changed files with 5 additions and 9 deletions
+4 -5
View File
@@ -132,16 +132,15 @@ bool AStack::loadWeights(const std::string &dir)
bool AStack::saveWeights(const std::string &dir) bool AStack::saveWeights(const std::string &dir)
{ {
bool result = true;
Layer *pLayer = m_pLayers; Layer *pLayer = m_pLayers;
while(pLayer) while(pLayer)
{ {
if (!pLayer->weightsSave(dir, m_name)) bool success = pLayer->weightsSave(dir, m_name);
{ result &= success;
return false;
}
pLayer = pLayer->next; pLayer = pLayer->next;
} }
return true; return result;
} }
arma::mat& AStack::trainingBatch() arma::mat& AStack::trainingBatch()
+1 -4
View File
@@ -133,10 +133,7 @@ int main(int argc, char *argv[])
if (command == Command::Reset) if (command == Command::Reset)
{ {
for (int i=0; i < stack->numLayers(); i++) stack->weightsInit(0.01);
{
stack->getLayer(i)->weightsInit(0.01);
}
stack->saveWeights("."); stack->saveWeights(".");
} }