Neuron Class Reference

#include <neuron.h>

Public Member Functions

 Neuron (size_t n_in, std::string activate_function="tanh")
 
 Neuron (const Neuron &other)
 
Neuronoperator= (const Neuron &other)
 
 Neuron (Neuron &&other) noexcept
 
Neuronoperator= (Neuron &&other) noexcept
 
 ~Neuron ()
 
const std::vector< Variable > & weights () const
 
const Variablebias () const
 
const std::vector< Variable > & parameters () const
 
Variable forward (const std::vector< double > &inputs)
 
Variable forward (const std::vector< Variable > &variables)
 

Detailed Description

This class represents a neuron in a neural network.

Constructor & Destructor Documentation

◆ Neuron() [1/3]

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

Constructs a neuron with the specified number of input connections and activation function.

Parameters
n_inThe number of input connections.
activate_functionThe activation function of the neuron. Default is "tanh".

◆ Neuron() [2/3]

Neuron::Neuron ( const Neuron other)
inline

Copy constructor.

Parameters
otherThe neuron to be copied.

◆ Neuron() [3/3]

Neuron::Neuron ( Neuron &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe neuron to be moved.

◆ ~Neuron()

Neuron::~Neuron ( )
inline

Destructor.

Member Function Documentation

◆ bias()

const Variable& Neuron::bias ( ) const
inline

Returns the bias of the neuron.

Returns
The bias.

◆ forward() [1/2]

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

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

Parameters
inputsThe input values.
Returns
The output value of the neuron.

◆ forward() [2/2]

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

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

Parameters
variablesThe input variables.
Returns
The output value of the neuron.

◆ operator=() [1/2]

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

Copy assignment operator.

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

◆ operator=() [2/2]

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

Move assignment operator.

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

◆ parameters()

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

Returns all parameters of the neuron, including weights and bias.

Returns
The parameters.

◆ weights()

const std::vector<Variable>& Neuron::weights ( ) const
inline

Returns the weights of the neuron.

Returns
The weights.

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