NNFS
Neural network library from scratch
Loading...
Searching...
No Matches
NNFS::Layer Class Referenceabstract

Base class for all layers. More...

#include <Layer.hpp>

Inheritance diagram for NNFS::Layer:
[legend]

Public Member Functions

 Layer (LayerType type)
 Construct a new Layer object.
 
virtual ~Layer ()=default
 Basic destructor.
 
virtual void forward (Eigen::MatrixXd &out, const Eigen::MatrixXd &x)=0
 Forward pass of the layer.
 
virtual void backward (Eigen::MatrixXd &out, const Eigen::MatrixXd &dx)=0
 Backward pass of the layer.
 

Public Attributes

LayerType type
 

Detailed Description

Base class for all layers.

This class is the base class for all layers. It provides the interface for all layers.

Constructor & Destructor Documentation

◆ Layer()

NNFS::Layer::Layer ( LayerType  type)
inline

Construct a new Layer object.

Parameters
typeType of layer

◆ ~Layer()

virtual NNFS::Layer::~Layer ( )
virtualdefault

Basic destructor.

Member Function Documentation

◆ backward()

virtual void NNFS::Layer::backward ( Eigen::MatrixXd &  out,
const Eigen::MatrixXd &  dx 
)
pure virtual

Backward pass of the layer.

Parameters
[out]outInput gradient
[in]dxOutput gradient

Implemented in NNFS::Dense, NNFS::ReLU, NNFS::Sigmoid, NNFS::Softmax, and NNFS::Tanh.

◆ forward()

virtual void NNFS::Layer::forward ( Eigen::MatrixXd &  out,
const Eigen::MatrixXd &  x 
)
pure virtual

Forward pass of the layer.

Parameters
[out]outOutput data
[in]xInput data

Implemented in NNFS::Dense, NNFS::ReLU, NNFS::Sigmoid, NNFS::Softmax, and NNFS::Tanh.

Member Data Documentation

◆ type

LayerType NNFS::Layer::type

The documentation for this class was generated from the following file: