Layer Class Reference

#include <layer.h>

Public Member Functions

 Layer (size_t n_in, size_t n_out, std::string activate_function="tanh")
 
 Layer (const Layer &other)
 
Layeroperator= (const Layer &other)
 
Layeroperator= (Layer &&other) noexcept
 
 Layer (Layer &&other) noexcept
 
const std::vector< Variable > & parameters () const
 
const std::vector< Neuron > & neurons () const
 
std::vector< Variableforward (const std::vector< double > &inputs)
 
std::vector< Variableforward (const std::vector< Variable > &variables)
 

Detailed Description

This class represents a layer in a neural network, consisting of multiple neurons.

Constructor & Destructor Documentation

◆ Layer() [1/3]

Layer::Layer ( size_t  n_in,
size_t  n_out,
std::string  activate_function = "tanh" 
)
inline

Constructs a layer with the specified number of input and output connections, and activation function.

Parameters
n_inThe number of input connections.
n_outThe number of output connections.
activate_functionThe activation function of the layer. Default is "tanh".

◆ Layer() [2/3]

Layer::Layer ( const Layer other)
inline

Copy constructor.

Parameters
otherThe layer to be copied.

◆ Layer() [3/3]

Layer::Layer ( Layer &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe layer to be assigned.
Returns
A reference to the assigned layer.

Member Function Documentation

◆ forward() [1/2]

std::vector< Variable > Layer::forward ( const std::vector< double > &  inputs)

Computes the forward pass of the layer given a vector of input values.

Parameters
inputsThe input values.
Returns
The output values of the layer as a vector of Variables.

◆ forward() [2/2]

std::vector< Variable > Layer::forward ( const std::vector< Variable > &  variables)

Computes the forward pass of the layer given a vector of input variables.

Parameters
variablesThe input variables.
Returns
The output values of the layer as a vector of Variables.

◆ neurons()

const std::vector<Neuron>& Layer::neurons ( ) const
inline

Returns the neurons in the layer.

Returns
The neurons.

◆ operator=() [1/2]

Layer& Layer::operator= ( const Layer other)
inline

Copy assignment operator.

Parameters
otherThe layer to be assigned.
Returns
A reference to the assigned layer.

◆ operator=() [2/2]

Layer& Layer::operator= ( Layer &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe layer to be moved.

◆ parameters()

const std::vector<Variable>& Layer::parameters ( ) const
inline

Returns all parameters of the layer, including parameters of all neurons.

Returns
The parameters.

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