- added Layer

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@576 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-10-25 16:03:33 +00:00
parent 36fc99df9c
commit 3e90330cd1
2 changed files with 88 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Layer.cpp
* Author: jens
*
* Created on 25. Oktober 2019, 08:13
*/
#include "Layer.hpp"
using namespace std;
Layer::Layer(const string &prjname, size_t id, size_t numVisible, size_t numHidden)
: m_prjname(prjname)
, m_id(id)
, m_rbm(m_rbm_params, numVisible, numHidden)
{
}
Layer::Layer(const Layer& orig)
: m_prjname(orig.m_prjname)
, m_id(orig.m_id)
, m_rbm_params(orig.m_rbm_params)
, m_rbm(orig.m_rbm)
{
}
Layer::~Layer()
{
}
Json::Value Layer::toJson() const
{
Json::Value layer;
layer["name"] = string("Layer ") + to_string((int)m_id);
layer["weights_file"] = m_prjname + string(".weights.dat");
layer["rbm"] = m_rbm.toJson();
return layer;
}
+41
View File
@@ -0,0 +1,41 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Layer.hpp
* Author: jens
*
* Created on 25. Oktober 2019, 08:13
*/
#ifndef LAYER_HPP
#define LAYER_HPP
#include <string>
#include <armadillo>
#include <jsoncpp/json/json.h>
#include "Rbm.hpp"
class Layer
{
public:
Layer(const std::string &prjname, size_t id, size_t numVisible, size_t numHidden);
Layer(const Layer& orig);
virtual ~Layer();
Json::Value toJson() const;
private:
const std::string &m_prjname;
size_t m_id;
Rbm::Params m_rbm_params;
Rbm m_rbm;
};
#endif /* LAYER_HPP */