NNFS
Neural network library from scratch
Loading...
Searching...
No Matches
Layer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Eigen/Dense>
4#include "../Utilities/clue.hpp"
5
6namespace NNFS
7{
11 enum class LayerType
12 {
13 DENSE,
15 };
16
22 class Layer
23 {
24 public:
25 LayerType type; // Type of layer
26
27 public:
34
38 virtual ~Layer() = default;
39
46 virtual void forward(Eigen::MatrixXd &out, const Eigen::MatrixXd &x) = 0;
47
54 virtual void backward(Eigen::MatrixXd &out, const Eigen::MatrixXd &dx) = 0;
55 };
56} // namespace NNFS
Base class for all layers.
Definition Layer.hpp:23
Layer(LayerType type)
Construct a new Layer object.
Definition Layer.hpp:33
virtual ~Layer()=default
Basic destructor.
virtual void forward(Eigen::MatrixXd &out, const Eigen::MatrixXd &x)=0
Forward pass of the layer.
LayerType type
Definition Layer.hpp:25
virtual void backward(Eigen::MatrixXd &out, const Eigen::MatrixXd &dx)=0
Backward pass of the layer.
Definition Activation.hpp:6
LayerType
Enum class for layer types.
Definition Layer.hpp:12