- init weights on model load error

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@830 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-01-18 15:36:04 +00:00
parent 36010b12eb
commit 87fc780461
2 changed files with 10 additions and 10 deletions
+6 -3
View File
@@ -115,16 +115,19 @@ void AStack::weightsInit(double stddev)
bool AStack::loadWeights(const std::string &dir)
{
bool result = true;
Layer *pLayer = m_pLayers;
while(pLayer)
{
if (!pLayer->weightsLoad(dir, m_name))
bool success = pLayer->weightsLoad(dir, m_name);
if (!success)
{
return false;
pLayer->weightsInit(0.01, 0);
}
result &= success;
pLayer = pLayer->next;
}
return true;
return result;
}
bool AStack::saveWeights(const std::string &dir)