Layer Class Reference

This abstract class represents the concept of a layer of neurons in OpenNN. More...

#include <layer.h>

Inheritance diagram for Layer:
BoundingLayer LongShortTermMemoryLayer PerceptronLayer ProbabilisticLayer RecurrentLayer ScalingLayer UnscalingLayer

Public Types

enum class  Type {
  Scaling , Convolutional , Perceptron , Pooling ,
  Probabilistic , LongShortTermMemory , Recurrent , Unscaling ,
  Bounding
}
 This enumeration represents the possible types of layers. More...
 

Public Member Functions

string get_name () const
 
virtual void set_parameters_constant (const type &)
 
virtual void set_parameters_random ()
 
virtual Tensor< type, 1 > get_parameters () const
 
virtual Index get_parameters_number () const
 
virtual void set_parameters (const Tensor< type, 1 > &, const Index &)
 
void set_threads_number (const int &)
 
virtual void insert_gradient (LayerBackPropagation *, const Index &, Tensor< type, 1 > &) const
 
virtual Tensor< type, 2 > calculate_outputs (const Tensor< type, 2 > &)
 
virtual Tensor< type, 2 > calculate_outputs_from4D (const Tensor< type, 4 > &)
 
virtual Tensor< type, 4 > calculate_outputs_4d (const Tensor< type, 4 > &)
 
virtual void forward_propagate (const Tensor< type, 2 > &, LayerForwardPropagation *)
 
virtual void forward_propagate (const Tensor< type, 4 > &, LayerForwardPropagation *)
 
virtual void forward_propagate (const Tensor< type, 4 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
virtual void forward_propagate (const Tensor< type, 2 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
virtual void calculate_hidden_delta (LayerForwardPropagation *, LayerBackPropagation *, LayerForwardPropagation *, LayerBackPropagation *) const
 
virtual void calculate_hidden_delta_lm (LayerForwardPropagation *, LayerBackPropagationLM *, LayerBackPropagationLM *) const
 
virtual void calculate_error_gradient (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagation *) const
 
virtual void calculate_error_gradient (const Tensor< type, 4 > &, LayerForwardPropagation *, LayerBackPropagation *) const
 
virtual void calculate_squared_errors_Jacobian_lm (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagationLM *)
 
virtual void insert_squared_errors_Jacobian_lm (LayerBackPropagationLM *, const Index &, Tensor< type, 2 > &) const
 
virtual Index get_inputs_number () const
 Returns the number of inputs. More...
 
virtual Index get_neurons_number () const
 
virtual Index get_synaptic_weights_number () const
 Returns the number of layer's synaptic weights. More...
 
virtual void set_inputs_number (const Index &)
 
virtual void set_neurons_number (const Index &)
 
Type get_type () const
 
string get_type_string () const
 Takes the type of layer used by the model. More...
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
virtual void write_XML (tinyxml2::XMLPrinter &) const
 
virtual string write_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const
 
virtual string write_expression_c () const
 
virtual string write_expression_python () const
 

Protected Member Functions

void hard_sigmoid (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hyperbolic_tangent (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void logistic (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void symmetric_threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void rectified_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void scaled_exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_plus (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_sign (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void softmax (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void binary (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void competitive (const Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void logistic_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_plus_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void soft_sign_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const
 
void hard_sigmoid (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hyperbolic_tangent (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void symmetric_threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void rectified_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void scaled_exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_plus (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_sign (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void softmax (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void binary (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void competitive (const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_plus_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void soft_sign_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const
 
void softmax_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const
 
void linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void logistic (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hyperbolic_tangent (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void symmetric_threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void rectified_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void scaled_exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_plus (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_sign (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hard_sigmoid (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void logistic_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hyperbolic_tangent_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void symmetric_threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void rectified_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void scaled_exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_plus_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void soft_sign_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void hard_sigmoid_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 

Protected Attributes

ThreadPool * thread_pool = nullptr
 
ThreadPoolDevice * thread_pool_device = nullptr
 
string layer_name = "layer"
 Layer name. More...
 
Type layer_type = Type::Perceptron
 Layer type. More...
 
const Eigen::array< IndexPair< Index >, 1 > A_BT = {IndexPair<Index>(1, 1)}
 
const Eigen::array< IndexPair< Index >, 1 > AT_B = {IndexPair<Index>(0, 0)}
 
const Eigen::array< IndexPair< Index >, 1 > A_B = {IndexPair<Index>(1, 0)}
 

Detailed Description

This abstract class represents the concept of a layer of neurons in OpenNN.

A layer is a group of neurons that have connections to the same inputs and send outputs to the same destinations. It is also used to store information about the layers of the different architectures of NeuralNetworks.

Definition at line 52 of file layer.h.

Member Enumeration Documentation

◆ Type

enum class Type
strong

This enumeration represents the possible types of layers.

Definition at line 61 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

Layer ( )
inlineexplicit

Definition at line 66 of file layer.h.

◆ ~Layer()

~Layer ( )
virtual

Definition at line 14 of file layer.cpp.

Member Function Documentation

◆ binary() [1/2]

void binary ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 351 of file layer.cpp.

◆ binary() [2/2]

void binary ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 767 of file layer.cpp.

◆ calculate_error_gradient() [1/2]

virtual void calculate_error_gradient ( const Tensor< type, 2 > &  ,
LayerForwardPropagation ,
LayerBackPropagation  
) const
inlinevirtual

Definition at line 127 of file layer.h.

◆ calculate_error_gradient() [2/2]

virtual void calculate_error_gradient ( const Tensor< type, 4 > &  ,
LayerForwardPropagation ,
LayerBackPropagation  
) const
inlinevirtual

Definition at line 131 of file layer.h.

◆ calculate_hidden_delta()

virtual void calculate_hidden_delta ( LayerForwardPropagation ,
LayerBackPropagation ,
LayerForwardPropagation ,
LayerBackPropagation  
) const
inlinevirtual

Definition at line 116 of file layer.h.

◆ calculate_hidden_delta_lm()

virtual void calculate_hidden_delta_lm ( LayerForwardPropagation ,
LayerBackPropagationLM ,
LayerBackPropagationLM  
) const
inlinevirtual

Definition at line 121 of file layer.h.

◆ calculate_outputs()

Tensor< type, 2 > calculate_outputs ( const Tensor< type, 2 > &  )
virtual

Reimplemented in BoundingLayer, ProbabilisticLayer, ScalingLayer, and UnscalingLayer.

Definition at line 139 of file layer.cpp.

◆ calculate_outputs_4d()

virtual Tensor< type, 4 > calculate_outputs_4d ( const Tensor< type, 4 > &  )
inlinevirtual

Definition at line 106 of file layer.h.

◆ calculate_outputs_from4D()

virtual Tensor< type, 2 > calculate_outputs_from4D ( const Tensor< type, 4 > &  )
inlinevirtual

Definition at line 104 of file layer.h.

◆ calculate_squared_errors_Jacobian_lm()

virtual void calculate_squared_errors_Jacobian_lm ( const Tensor< type, 2 > &  ,
LayerForwardPropagation ,
LayerBackPropagationLM  
)
inlinevirtual

Definition at line 137 of file layer.h.

◆ competitive() [1/2]

void competitive ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 367 of file layer.cpp.

◆ competitive() [2/2]

void competitive ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected
Todo:
exception with several maximum indices

Definition at line 785 of file layer.cpp.

◆ exponential_linear() [1/3]

void exponential_linear ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 333 of file layer.cpp.

◆ exponential_linear() [2/3]

void exponential_linear ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 749 of file layer.cpp.

◆ exponential_linear() [3/3]

void exponential_linear ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1288 of file layer.cpp.

◆ exponential_linear_derivatives() [1/3]

void exponential_linear_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 594 of file layer.cpp.

◆ exponential_linear_derivatives() [2/3]

void exponential_linear_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 1054 of file layer.cpp.

◆ exponential_linear_derivatives() [3/3]

void exponential_linear_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1528 of file layer.cpp.

◆ forward_propagate() [1/4]

virtual void forward_propagate ( const Tensor< type, 2 > &  ,
LayerForwardPropagation  
)
inlinevirtual

Definition at line 108 of file layer.h.

◆ forward_propagate() [2/4]

virtual void forward_propagate ( const Tensor< type, 2 > &  ,
Tensor< type, 1 >  ,
LayerForwardPropagation  
)
inlinevirtual

Definition at line 112 of file layer.h.

◆ forward_propagate() [3/4]

virtual void forward_propagate ( const Tensor< type, 4 > &  ,
LayerForwardPropagation  
)
inlinevirtual

Definition at line 109 of file layer.h.

◆ forward_propagate() [4/4]

virtual void forward_propagate ( const Tensor< type, 4 > &  ,
Tensor< type, 1 >  ,
LayerForwardPropagation  
)
inlinevirtual

Definition at line 111 of file layer.h.

◆ from_XML()

virtual void from_XML ( const tinyxml2::XMLDocument )
inlinevirtual

Reimplemented in BoundingLayer, ProbabilisticLayer, ScalingLayer, and UnscalingLayer.

Definition at line 161 of file layer.h.

◆ get_inputs_number()

Index get_inputs_number ( ) const
virtual

Returns the number of inputs.

Reimplemented in BoundingLayer, LongShortTermMemoryLayer, PerceptronLayer, ProbabilisticLayer, RecurrentLayer, ScalingLayer, and UnscalingLayer.

Definition at line 153 of file layer.cpp.

◆ get_name()

string get_name ( ) const
inline

Definition at line 78 of file layer.h.

◆ get_neurons_number()

Index get_neurons_number ( ) const
virtual

Reimplemented in BoundingLayer, LongShortTermMemoryLayer, PerceptronLayer, RecurrentLayer, and UnscalingLayer.

Definition at line 165 of file layer.cpp.

◆ get_parameters()

Tensor< type, 1 > get_parameters ( ) const
virtual

Reimplemented in LongShortTermMemoryLayer, PerceptronLayer, ProbabilisticLayer, and RecurrentLayer.

Definition at line 127 of file layer.cpp.

◆ get_parameters_number()

Index get_parameters_number ( ) const
virtual

Reimplemented in LongShortTermMemoryLayer, PerceptronLayer, ProbabilisticLayer, and RecurrentLayer.

Definition at line 115 of file layer.cpp.

◆ get_synaptic_weights_number()

Index get_synaptic_weights_number ( ) const
virtual

Returns the number of layer's synaptic weights.

Reimplemented in PerceptronLayer, and ProbabilisticLayer.

Definition at line 179 of file layer.cpp.

◆ get_type()

Layer::Type get_type ( ) const

Default constructor. It creates a layer object with zero parameters. It also initializes the rest of class members to their default values.

Definition at line 25 of file layer.cpp.

◆ get_type_string()

string get_type_string ( ) const

Takes the type of layer used by the model.

Definition at line 33 of file layer.cpp.

◆ hard_sigmoid() [1/3]

void hard_sigmoid ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 215 of file layer.cpp.

◆ hard_sigmoid() [2/3]

void hard_sigmoid ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 627 of file layer.cpp.

◆ hard_sigmoid() [3/3]

void hard_sigmoid ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected
Todo:
Test this method.

Definition at line 1266 of file layer.cpp.

◆ hard_sigmoid_derivatives() [1/3]

void hard_sigmoid_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 387 of file layer.cpp.

◆ hard_sigmoid_derivatives() [2/3]

void hard_sigmoid_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 836 of file layer.cpp.

◆ hard_sigmoid_derivatives() [3/3]

void hard_sigmoid_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1490 of file layer.cpp.

◆ hyperbolic_tangent() [1/3]

void hyperbolic_tangent ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 232 of file layer.cpp.

◆ hyperbolic_tangent() [2/3]

void hyperbolic_tangent ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 651 of file layer.cpp.

◆ hyperbolic_tangent() [3/3]

void hyperbolic_tangent ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1178 of file layer.cpp.

◆ hyperbolic_tangent_derivatives() [1/3]

void hyperbolic_tangent_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 426 of file layer.cpp.

◆ hyperbolic_tangent_derivatives() [2/3]

void hyperbolic_tangent_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 874 of file layer.cpp.

◆ hyperbolic_tangent_derivatives() [3/3]

void hyperbolic_tangent_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1331 of file layer.cpp.

◆ insert_gradient()

virtual void insert_gradient ( LayerBackPropagation ,
const Index &  ,
Tensor< type, 1 > &   
) const
inlinevirtual

Definition at line 98 of file layer.h.

◆ insert_squared_errors_Jacobian_lm()

virtual void insert_squared_errors_Jacobian_lm ( LayerBackPropagationLM ,
const Index &  ,
Tensor< type, 2 > &   
) const
inlinevirtual

Definition at line 141 of file layer.h.

◆ linear() [1/3]

void linear ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 244 of file layer.cpp.

◆ linear() [2/3]

void linear ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 663 of file layer.cpp.

◆ linear() [3/3]

void linear ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1166 of file layer.cpp.

◆ linear_derivatives() [1/3]

void linear_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 450 of file layer.cpp.

◆ linear_derivatives() [2/3]

void linear_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 902 of file layer.cpp.

◆ linear_derivatives() [3/3]

void linear_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1307 of file layer.cpp.

◆ logistic() [1/3]

void logistic ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 238 of file layer.cpp.

◆ logistic() [2/3]

void logistic ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 657 of file layer.cpp.

◆ logistic() [3/3]

void logistic ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1172 of file layer.cpp.

◆ logistic_derivatives() [1/4]

void logistic_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 440 of file layer.cpp.

◆ logistic_derivatives() [2/4]

void logistic_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 888 of file layer.cpp.

◆ logistic_derivatives() [3/4]

void logistic_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 3 > &  activations_derivatives 
) const
protected

Definition at line 1084 of file layer.cpp.

◆ logistic_derivatives() [4/4]

void logistic_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1317 of file layer.cpp.

◆ rectified_linear() [1/3]

void rectified_linear ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 276 of file layer.cpp.

◆ rectified_linear() [2/3]

void rectified_linear ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 695 of file layer.cpp.

◆ rectified_linear() [3/3]

void rectified_linear ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1210 of file layer.cpp.

◆ rectified_linear_derivatives() [1/3]

void rectified_linear_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 502 of file layer.cpp.

◆ rectified_linear_derivatives() [2/3]

void rectified_linear_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 958 of file layer.cpp.

◆ rectified_linear_derivatives() [3/3]

void rectified_linear_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1387 of file layer.cpp.

◆ scaled_exponential_linear() [1/3]

void scaled_exponential_linear ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 288 of file layer.cpp.

◆ scaled_exponential_linear() [2/3]

void scaled_exponential_linear ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 707 of file layer.cpp.

◆ scaled_exponential_linear() [3/3]

void scaled_exponential_linear ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1222 of file layer.cpp.

◆ scaled_exponential_linear_derivatives() [1/3]

void scaled_exponential_linear_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 524 of file layer.cpp.

◆ scaled_exponential_linear_derivatives() [2/3]

void scaled_exponential_linear_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 980 of file layer.cpp.

◆ scaled_exponential_linear_derivatives() [3/3]

void scaled_exponential_linear_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1410 of file layer.cpp.

◆ set_inputs_number()

void set_inputs_number ( const Index &  )
virtual

Reimplemented in BoundingLayer, LongShortTermMemoryLayer, PerceptronLayer, and RecurrentLayer.

Definition at line 191 of file layer.cpp.

◆ set_neurons_number()

void set_neurons_number ( const Index &  )
virtual

Reimplemented in BoundingLayer, LongShortTermMemoryLayer, PerceptronLayer, and RecurrentLayer.

Definition at line 203 of file layer.cpp.

◆ set_parameters()

void set_parameters ( const Tensor< type, 1 > &  ,
const Index &   
)
virtual

Reimplemented in LongShortTermMemoryLayer, RecurrentLayer, and PerceptronLayer.

Definition at line 103 of file layer.cpp.

◆ set_parameters_constant()

void set_parameters_constant ( const type &  )
virtual

Reimplemented in LongShortTermMemoryLayer, PerceptronLayer, ProbabilisticLayer, and RecurrentLayer.

Definition at line 79 of file layer.cpp.

◆ set_parameters_random()

void set_parameters_random ( )
virtual

Reimplemented in LongShortTermMemoryLayer, PerceptronLayer, ProbabilisticLayer, and RecurrentLayer.

Definition at line 91 of file layer.cpp.

◆ set_threads_number()

void set_threads_number ( const int &  new_threads_number)

Definition at line 69 of file layer.cpp.

◆ soft_plus() [1/3]

void soft_plus ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 309 of file layer.cpp.

◆ soft_plus() [2/3]

void soft_plus ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 727 of file layer.cpp.

◆ soft_plus() [3/3]

void soft_plus ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1242 of file layer.cpp.

◆ soft_plus_derivatives() [1/3]

void soft_plus_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 556 of file layer.cpp.

◆ soft_plus_derivatives() [2/3]

void soft_plus_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 1013 of file layer.cpp.

◆ soft_plus_derivatives() [3/3]

void soft_plus_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1444 of file layer.cpp.

◆ soft_sign() [1/3]

void soft_sign ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 316 of file layer.cpp.

◆ soft_sign() [2/3]

void soft_sign ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 733 of file layer.cpp.

◆ soft_sign() [3/3]

void soft_sign ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1248 of file layer.cpp.

◆ soft_sign_derivatives() [1/3]

void soft_sign_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 566 of file layer.cpp.

◆ soft_sign_derivatives() [2/3]

void soft_sign_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 1025 of file layer.cpp.

◆ soft_sign_derivatives() [3/3]

void soft_sign_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1460 of file layer.cpp.

◆ softmax() [1/2]

void softmax ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 377 of file layer.cpp.

◆ softmax() [2/2]

void softmax ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 803 of file layer.cpp.

◆ softmax_derivatives()

void softmax_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 3 > &  activations_derivatives 
) const
protected
Todo:
Add #pragma parallel for in loops.

Definition at line 1102 of file layer.cpp.

◆ symmetric_threshold() [1/3]

void symmetric_threshold ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 264 of file layer.cpp.

◆ symmetric_threshold() [2/3]

void symmetric_threshold ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 683 of file layer.cpp.

◆ symmetric_threshold() [3/3]

void symmetric_threshold ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1198 of file layer.cpp.

◆ symmetric_threshold_derivatives() [1/3]

void symmetric_threshold_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 482 of file layer.cpp.

◆ symmetric_threshold_derivatives() [2/3]

void symmetric_threshold_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 937 of file layer.cpp.

◆ symmetric_threshold_derivatives() [3/3]

void symmetric_threshold_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1367 of file layer.cpp.

◆ threshold() [1/3]

void threshold ( const Tensor< type, 1 > &  x,
Tensor< type, 1 > &  y 
) const
protected

Definition at line 250 of file layer.cpp.

◆ threshold() [2/3]

void threshold ( const Tensor< type, 2 > &  x,
Tensor< type, 2 > &  y 
) const
protected

Definition at line 669 of file layer.cpp.

◆ threshold() [3/3]

void threshold ( const Tensor< type, 4 > &  x,
Tensor< type, 4 > &  y 
) const
protected

Definition at line 1184 of file layer.cpp.

◆ threshold_derivatives() [1/3]

void threshold_derivatives ( const Tensor< type, 1 > &  combinations,
Tensor< type, 1 > &  activations,
Tensor< type, 1 > &  activations_derivatives 
) const
protected

Definition at line 460 of file layer.cpp.

◆ threshold_derivatives() [2/3]

void threshold_derivatives ( const Tensor< type, 2 > &  combinations,
Tensor< type, 2 > &  activations,
Tensor< type, 2 > &  activations_derivatives 
) const
protected

Definition at line 913 of file layer.cpp.

◆ threshold_derivatives() [3/3]

void threshold_derivatives ( const Tensor< type, 4 > &  combinations,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const
protected

Definition at line 1345 of file layer.cpp.

◆ write_expression()

virtual string write_expression ( const Tensor< string, 1 > &  ,
const Tensor< string, 1 > &   
) const
inlinevirtual

◆ write_expression_c()

virtual string write_expression_c ( ) const
inlinevirtual

Reimplemented in BoundingLayer, ScalingLayer, and UnscalingLayer.

Definition at line 169 of file layer.h.

◆ write_expression_python()

virtual string write_expression_python ( ) const
inlinevirtual

Reimplemented in BoundingLayer, and UnscalingLayer.

Definition at line 171 of file layer.h.

◆ write_XML()

virtual void write_XML ( tinyxml2::XMLPrinter ) const
inlinevirtual

Reimplemented in BoundingLayer, ProbabilisticLayer, ScalingLayer, and UnscalingLayer.

Definition at line 163 of file layer.h.

Member Data Documentation

◆ A_B

const Eigen::array<IndexPair<Index>, 1> A_B = {IndexPair<Index>(1, 0)}
protected

Definition at line 276 of file layer.h.

◆ A_BT

const Eigen::array<IndexPair<Index>, 1> A_BT = {IndexPair<Index>(1, 1)}
protected

Definition at line 274 of file layer.h.

◆ AT_B

const Eigen::array<IndexPair<Index>, 1> AT_B = {IndexPair<Index>(0, 0)}
protected

Definition at line 275 of file layer.h.

◆ layer_name

string layer_name = "layer"
protected

Layer name.

Definition at line 181 of file layer.h.

◆ layer_type

Type layer_type = Type::Perceptron
protected

Layer type.

Definition at line 185 of file layer.h.

◆ thread_pool

ThreadPool* thread_pool = nullptr
protected

Definition at line 175 of file layer.h.

◆ thread_pool_device

ThreadPoolDevice* thread_pool_device = nullptr
protected

Definition at line 177 of file layer.h.


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