- refactored

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@824 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-01-17 20:22:10 +00:00
parent e55f8e2153
commit 51e6eef12e
8 changed files with 34 additions and 62 deletions
-37
View File
@@ -26,10 +26,6 @@ AStack::AStack(StackType type, const std::string &name)
{
}
AStack::AStack(const AStack& orig)
{
}
AStack::~AStack()
{
Layer *pLayer = m_pLayers;
@@ -41,39 +37,6 @@ AStack::~AStack()
}
}
AStack::AStack(StackType type, const std::string &name, Json::Value& layers, LayerConstructor* pLayerConstructor)
: m_type(type)
, m_name(name)
, m_pLayers(nullptr)
{
for (int i=0; i < layers.size(); i++)
{
Json::Value &layer = layers[i];
string layername = layer["name"].asString();
int numVisibleX = layer["numVisibleX"].asInt();
int numVisibleY = layer["numVisibleY"].asInt();
int numHidden = layer["numHidden"].asInt();
int numContext = layer["numContext"].asInt();
Layer *pLayer = nullptr;
if (!pLayerConstructor)
{
pLayer = new Layer(layername, i, numVisibleX, numVisibleY, numHidden, numContext);
}
else
{
pLayer = pLayerConstructor->onConstruct(this, layername, i, numVisibleX, numVisibleY, numHidden, numContext);
}
assert(pLayer != nullptr);
pLayer->fromJson(layer["rbm"]);
addLayer(pLayer);
}
}
AStack::StackType AStack::type()
{
return m_type;