# Deep network: src/layers/layer.hpp Source File

layer.hpp
Go to the documentation of this file.
#ifndef LAYER_HPP
#define LAYER_HPP
#include "debug.hpp"
#include "vector.hpp"
#include "shape.hpp"
#include <cmath>
namespace Layer{
class Layer{
public:
string name;
size_t n;
size_t m;
Vector x;
Vector y;
Vector d;
Layer(size_t n,size_t m);
~Layer();
size_t get_input_size() const;
size_t get_output_size() const;
Vector get_output() const;
virtual Vector feed_forward(Vector x)=0;
virtual void init_nabla()=0;
virtual Vector back_propagation(Vector e)=0;
virtual void update(Real eta)=0;
};
inline
Layer::Layer(size_t n_,size_t m_){
n=n_;
m=m_;
y=init_vector(m);
d=init_vector(n);
}
inline
Layer::~Layer(){
delete_vector(y);
delete_vector(d);
}
inline size_t
Layer::get_input_size() const{
return n;
}
inline size_t
Layer::get_output_size() const{
return m;
}
inline Vector
Layer::get_output() const{
return y;
}
}
#endif
Layer::Layer
Definition: layer.hpp:20
Layer::Layer::name
string name
Definition: layer.hpp:23
Layer::Layer::init_nabla
virtual void init_nabla()=0
Layer::Layer::m
size_t m
Definition: layer.hpp:29
Layer::Layer::update
virtual void update(Real eta)=0
Layer::Layer::n
size_t n
Definition: layer.hpp:26
Layer::Layer::y
Vector y
Definition: layer.hpp:35
Layer::Layer::back_propagation
virtual Vector back_propagation(Vector e)=0
Layer::Layer::feed_forward
virtual Vector feed_forward(Vector x)=0
Layer::Layer::x
Vector x
Definition: layer.hpp:32
Layer::Layer::d
Vector d
Definition: layer.hpp:38
debug.hpp
Layer
Definition: activation.hpp:7
shape.hpp
vector.hpp
delete_vector
void delete_vector(Vector v)
Definition: vector.hpp:53
Real
double Real
Definition: vector.hpp:9
init_vector
Vector init_vector(size_t n)
Definition: vector.hpp:48
Vector
Real * Vector
Definition: vector.hpp:45