ConvolutionalLayer Class Reference
Inheritance diagram for ConvolutionalLayer:
Layer

Public Types

enum class  ActivationFunction {
  Threshold , SymmetricThreshold , Logistic , HyperbolicTangent ,
  Linear , RectifiedLinear , ExponentialLinear , ScaledExponentialLinear ,
  SoftPlus , SoftSign , HardSigmoid
}
 Enumeration of available activation functions for the convolutional layer. More...
 
enum class  ConvolutionType { Valid , Same }
 
- Public Types inherited from Layer
enum class  Type {
  Scaling , Convolutional , Perceptron , Pooling ,
  Probabilistic , LongShortTermMemory , Recurrent , Unscaling ,
  Bounding
}
 This enumeration represents the possible types of layers. More...
 

Public Member Functions

 ConvolutionalLayer ()
 
 ConvolutionalLayer (const Tensor< Index, 1 > &, const Tensor< Index, 1 > &)
 
bool is_empty () const
 Returns a boolean, true if convolutional layer is empty and false otherwise. More...
 
const Tensor< type, 1 > & get_biases () const
 Returns the layer's biases. More...
 
const Tensor< type, 4 > & get_synaptic_weights () const
 Returns the layer's synaptic weights. More...
 
Index get_synaptic_weights_number () const
 Returns the number of layer's synaptic weights. More...
 
ActivationFunction get_activation_function () const
 Returns the convolutional layer's activation function. More...
 
Tensor< Index, 1 > get_outputs_dimensions () const
 Returns a vector containing the number of channels, rows and columns of the result of applying the layer's kernels to an image. More...
 
Tensor< Index, 1 > get_input_variables_dimensions () const
 Returns the dimension of the input variables. More...
 
Index get_outputs_rows_number () const
 Returns the number of rows the result of applying the layer's kernels to an image will have. More...
 
Index get_outputs_columns_number () const
 Returns the number of columns the result of applying the layer's kernels to an image will have. More...
 
ConvolutionType get_convolution_type () const
 Returns the padding option. More...
 
Index get_column_stride () const
 Returns the column stride. More...
 
Index get_row_stride () const
 Returns the row stride. More...
 
Index get_kernels_number () const
 Returns the number of kernels of the layer. More...
 
Index get_kernels_channels_number () const
 Returns the number of channels of the layer's kernels. More...
 
Index get_kernels_rows_number () const
 Returns the number of rows of the layer's kernels. More...
 
Index get_kernels_columns_number () const
 Returns the number of columns of the layer's kernels. More...
 
Index get_padding_width () const
 Returns the total number of columns of zeroes to be added to an image before applying a kernel, which depends on the padding option set. More...
 
Index get_padding_height () const
 Returns the total number of rows of zeroes to be added to an image before applying a kernel, which depends on the padding option set. More...
 
Index get_inputs_channels_number () const
 Returns the number of channels of the input. More...
 
Index get_inputs_rows_number () const
 Returns the number of rows of the input. More...
 
Index get_inputs_columns_number () const
 Returns the number of columns of the input. More...
 
Index get_inputs_number () const
 Returns the number of inputs. More...
 
Index get_neurons_number () const
 Returns the number of neurons. More...
 
Tensor< type, 1 > get_parameters () const
 Returns the layer's parameters in the form of a vector. More...
 
Index get_parameters_number () const
 Returns the number of parameters of the layer. More...
 
void set (const Tensor< Index, 1 > &, const Tensor< Index, 1 > &)
 
void set (const Tensor< type, 4 > &, const Tensor< type, 4 > &, const Tensor< type, 1 > &)
 
void set_activation_function (const ActivationFunction &)
 
void set_biases (const Tensor< type, 1 > &)
 
void set_synaptic_weights (const Tensor< type, 4 > &)
 
void set_convolution_type (const ConvolutionType &)
 
void set_parameters (const Tensor< type, 1 > &, const Index &index)
 
void set_row_stride (const Index &)
 
void set_column_stride (const Index &)
 
void set_biases_constant (const type &)
 
void set_synaptic_weights_constant (const type &)
 
void set_parameters_constant (const type &)
 
void set_parameters_random ()
 
void insert_padding (const Tensor< type, 4 > &, Tensor< type, 4 > &)
 
void calculate_convolutions (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 Calculate convolutions. More...
 
void calculate_convolutions (const Tensor< type, 4 > &, const Tensor< type, 2 > &, const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void calculate_activations (const Tensor< type, 4 > &, Tensor< type, 4 > &) const
 Calculates activations. More...
 
void calculate_activations_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const
 
void calculate_outputs (const Tensor< type, 4 > &, Tensor< type, 4 > &)
 
void forward_propagate (const Tensor< type, 4 > &, LayerForwardPropagation *)
 
void forward_propagate (const Tensor< type, 2 > &, LayerForwardPropagation *)
 
void forward_propagate (const Tensor< type, 4 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
void forward_propagate (const Tensor< type, 2 > &, Tensor< type, 1 >, LayerForwardPropagation *)
 
void calculate_hidden_delta (Layer *, LayerForwardPropagation *, const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_hidden_delta_convolutional (ConvolutionalLayer *, const Tensor< type, 4 > &, const Tensor< type, 4 > &, const Tensor< type, 4 > &, Tensor< type, 2 > &) const
 
void calculate_hidden_delta_pooling (PoolingLayer *, const Tensor< type, 4 > &, const Tensor< type, 4 > &, const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_hidden_delta_perceptron (const PerceptronLayer *, const Tensor< type, 4 > &, const Tensor< type, 2 > &, const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_hidden_delta_probabilistic (ProbabilisticLayer *, const Tensor< type, 4 > &, const Tensor< type, 4 > &, const Tensor< type, 2 > &, Tensor< type, 2 > &) const
 
void calculate_error_gradient (const Tensor< type, 4 > &, LayerForwardPropagation *, LayerBackPropagation &) const
 
void calculate_error_gradient (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagation &) const
 
void insert_gradient (LayerBackPropagation *, const Index &, Tensor< type, 1 > &) const
 
void to_2d (const Tensor< type, 4 > &, Tensor< type, 2 > &) const
 
- Public Member Functions inherited from Layer
string get_name () const
 
void set_threads_number (const int &)
 
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 calculate_hidden_delta (LayerForwardPropagation *, LayerBackPropagation *, 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 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 Attributes

Tensor< type, 4 > synaptic_weights
 This tensor containing conection strengths from a layer's inputs to its neurons. More...
 
Tensor< type, 1 > biases
 
Index row_stride = 1
 
Index column_stride = 1
 
Tensor< Index, 1 > input_variables_dimensions
 
ConvolutionType convolution_type = ConvolutionType::Valid
 
ActivationFunction activation_function = ActivationFunction::RectifiedLinear
 
- Protected Attributes inherited from Layer
NonBlockingThreadPool * non_blocking_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)}
 

Additional Inherited Members

- Protected Member Functions inherited from Layer
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
 

Detailed Description

Definition at line 38 of file convolutional_layer.h.

Member Enumeration Documentation

◆ ActivationFunction

enum class ActivationFunction
strong

Enumeration of available activation functions for the convolutional layer.

Definition at line 45 of file convolutional_layer.h.

◆ ConvolutionType

enum class ConvolutionType
strong

Definition at line 47 of file convolutional_layer.h.

Constructor & Destructor Documentation

◆ ConvolutionalLayer() [1/2]

ConvolutionalLayer ( )
explicit

Default constructor. It creates an empty ConvolutionalLayer object.

Definition at line 22 of file convolutional_layer.cpp.

◆ ConvolutionalLayer() [2/2]

ConvolutionalLayer ( const Tensor< Index, 1 > &  new_inputs_dimensions,
const Tensor< Index, 1 > &  new_kernels_dimensions 
)
explicit

Inputs' dimensions modifier constructor. After setting new dimensions for the inputs, it creates and initializes a ConvolutionalLayer object with a number of kernels of a given size. The initialization values are random values from a normal distribution.

Parameters
new_inputs_dimensionsA vector containing the new inputs' dimensions.
kernels_dimensionsA vector containing the number of kernels, their rows and columns.

Definition at line 35 of file convolutional_layer.cpp.

Member Function Documentation

◆ calculate_activations()

void calculate_activations ( const Tensor< type, 4 > &  inputs,
Tensor< type, 4 > &  activations 
) const

Calculates activations.

Definition at line 134 of file convolutional_layer.cpp.

◆ calculate_activations_derivatives()

void calculate_activations_derivatives ( const Tensor< type, 4 > &  combinations_4d,
Tensor< type, 4 > &  activations,
Tensor< type, 4 > &  activations_derivatives 
) const

Definition at line 163 of file convolutional_layer.cpp.

◆ calculate_convolutions() [1/2]

void calculate_convolutions ( const Tensor< type, 4 > &  inputs,
const Tensor< type, 2 > &  potential_biases,
const Tensor< type, 4 > &  potential_synaptic_weights,
Tensor< type, 4 > &  convolutions 
) const

Definition at line 104 of file convolutional_layer.cpp.

◆ calculate_convolutions() [2/2]

void calculate_convolutions ( const Tensor< type, 4 > &  inputs,
Tensor< type, 4 > &  combinations 
) const

Calculate convolutions.

Definition at line 82 of file convolutional_layer.cpp.

◆ calculate_error_gradient() [1/2]

void calculate_error_gradient ( const Tensor< type, 2 > &  inputs,
LayerForwardPropagation forward_propagation,
LayerBackPropagation back_propagation 
) const

Definition at line 838 of file convolutional_layer.cpp.

◆ calculate_error_gradient() [2/2]

void calculate_error_gradient ( const Tensor< type, 4 > &  inputs,
LayerForwardPropagation forward_propagation,
LayerBackPropagation back_propagation 
) const

Definition at line 776 of file convolutional_layer.cpp.

◆ calculate_hidden_delta()

void calculate_hidden_delta ( Layer next_layer_pointer,
LayerForwardPropagation forward_propagation,
const Tensor< type, 2 > &  next_layer_delta,
Tensor< type, 2 > &  hidden_delta 
) const

Definition at line 355 of file convolutional_layer.cpp.

◆ calculate_hidden_delta_convolutional()

void calculate_hidden_delta_convolutional ( ConvolutionalLayer next_layer_pointer,
const Tensor< type, 4 > &  activations,
const Tensor< type, 4 > &  activations_derivatives,
const Tensor< type, 4 > &  next_layer_delta,
Tensor< type, 2 > &  hidden_delta 
) const

Definition at line 408 of file convolutional_layer.cpp.

◆ calculate_hidden_delta_perceptron()

void calculate_hidden_delta_perceptron ( const PerceptronLayer next_layer_pointer,
const Tensor< type, 4 > &  ,
const Tensor< type, 2 > &  activations_derivatives,
const Tensor< type, 2 > &  next_layer_delta,
Tensor< type, 2 > &  hidden_delta 
) const
Todo:

Definition at line 649 of file convolutional_layer.cpp.

◆ calculate_hidden_delta_pooling()

void calculate_hidden_delta_pooling ( PoolingLayer next_layer_pointer,
const Tensor< type, 4 > &  activations,
const Tensor< type, 4 > &  activations_derivatives,
const Tensor< type, 2 > &  next_layer_delta,
Tensor< type, 2 > &  hidden_delta 
) const

Definition at line 485 of file convolutional_layer.cpp.

◆ calculate_hidden_delta_probabilistic()

void calculate_hidden_delta_probabilistic ( ProbabilisticLayer next_layer_pointer,
const Tensor< type, 4 > &  activations,
const Tensor< type, 4 > &  activations_derivatives,
const Tensor< type, 2 > &  next_layer_delta,
Tensor< type, 2 > &  hidden_delta 
) const

Definition at line 709 of file convolutional_layer.cpp.

◆ calculate_outputs()

void calculate_outputs ( const Tensor< type, 4 > &  inputs,
Tensor< type, 4 > &  outputs 
)

Returns the output of the convolutional layer applied to a batch of images.

Parameters
inputsThe batch of images.
outputsTensor where the outputs will be stored.

Definition at line 198 of file convolutional_layer.cpp.

◆ forward_propagate() [1/4]

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

Reimplemented from Layer.

Definition at line 247 of file convolutional_layer.cpp.

◆ forward_propagate() [2/4]

void forward_propagate ( const Tensor< type, 2 > &  inputs,
Tensor< type, 1 >  potential_parameters,
LayerForwardPropagation forward_propagation 
)
virtual

Reimplemented from Layer.

Definition at line 335 of file convolutional_layer.cpp.

◆ forward_propagate() [3/4]

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

Reimplemented from Layer.

Definition at line 212 of file convolutional_layer.cpp.

◆ forward_propagate() [4/4]

void forward_propagate ( const Tensor< type, 4 > &  inputs,
Tensor< type, 1 >  potential_parameters,
LayerForwardPropagation forward_propagation 
)
virtual

Reimplemented from Layer.

Definition at line 262 of file convolutional_layer.cpp.

◆ get_activation_function()

ConvolutionalLayer::ActivationFunction get_activation_function ( ) const

Returns the convolutional layer's activation function.

Definition at line 876 of file convolutional_layer.cpp.

◆ get_biases()

const Tensor< type, 1 > & get_biases ( ) const

Returns the layer's biases.

Definition at line 1331 of file convolutional_layer.cpp.

◆ get_column_stride()

Index get_column_stride ( ) const

Returns the column stride.

Definition at line 939 of file convolutional_layer.cpp.

◆ get_convolution_type()

ConvolutionalLayer::ConvolutionType get_convolution_type ( ) const

Returns the padding option.

Definition at line 931 of file convolutional_layer.cpp.

◆ get_input_variables_dimensions()

Tensor< Index, 1 > get_input_variables_dimensions ( ) const

Returns the dimension of the input variables.

Definition at line 923 of file convolutional_layer.cpp.

◆ get_inputs_channels_number()

Index get_inputs_channels_number ( ) const

Returns the number of channels of the input.

Definition at line 1355 of file convolutional_layer.cpp.

◆ get_inputs_columns_number()

Index get_inputs_columns_number ( ) const

Returns the number of columns of the input.

Definition at line 1371 of file convolutional_layer.cpp.

◆ get_inputs_number()

Index get_inputs_number ( ) const
virtual

Returns the number of inputs.

Reimplemented from Layer.

Definition at line 1029 of file convolutional_layer.cpp.

◆ get_inputs_rows_number()

Index get_inputs_rows_number ( ) const

Returns the number of rows of the input.

Definition at line 1363 of file convolutional_layer.cpp.

◆ get_kernels_channels_number()

Index get_kernels_channels_number ( ) const

Returns the number of channels of the layer's kernels.

Definition at line 963 of file convolutional_layer.cpp.

◆ get_kernels_columns_number()

Index get_kernels_columns_number ( ) const

Returns the number of columns of the layer's kernels.

Definition at line 979 of file convolutional_layer.cpp.

◆ get_kernels_number()

Index get_kernels_number ( ) const

Returns the number of kernels of the layer.

Definition at line 955 of file convolutional_layer.cpp.

◆ get_kernels_rows_number()

Index get_kernels_rows_number ( ) const

Returns the number of rows of the layer's kernels.

Definition at line 971 of file convolutional_layer.cpp.

◆ get_neurons_number()

Index get_neurons_number ( ) const
virtual

Returns the number of neurons.

Reimplemented from Layer.

Definition at line 1037 of file convolutional_layer.cpp.

◆ get_outputs_columns_number()

Index get_outputs_columns_number ( ) const

Returns the number of columns the result of applying the layer's kernels to an image will have.

Definition at line 896 of file convolutional_layer.cpp.

◆ get_outputs_dimensions()

Tensor< Index, 1 > get_outputs_dimensions ( ) const

Returns a vector containing the number of channels, rows and columns of the result of applying the layer's kernels to an image.

Definition at line 908 of file convolutional_layer.cpp.

◆ get_outputs_rows_number()

Index get_outputs_rows_number ( ) const

Returns the number of rows the result of applying the layer's kernels to an image will have.

Definition at line 884 of file convolutional_layer.cpp.

◆ get_padding_height()

Index get_padding_height ( ) const

Returns the total number of rows of zeroes to be added to an image before applying a kernel, which depends on the padding option set.

Definition at line 1008 of file convolutional_layer.cpp.

◆ get_padding_width()

Index get_padding_width ( ) const

Returns the total number of columns of zeroes to be added to an image before applying a kernel, which depends on the padding option set.

Definition at line 987 of file convolutional_layer.cpp.

◆ get_parameters()

Tensor< type, 1 > get_parameters ( ) const
virtual

Returns the layer's parameters in the form of a vector.

Reimplemented from Layer.

Definition at line 1049 of file convolutional_layer.cpp.

◆ get_parameters_number()

Index get_parameters_number ( ) const
virtual

Returns the number of parameters of the layer.

Reimplemented from Layer.

Definition at line 1089 of file convolutional_layer.cpp.

◆ get_row_stride()

Index get_row_stride ( ) const

Returns the row stride.

Definition at line 947 of file convolutional_layer.cpp.

◆ get_synaptic_weights()

const Tensor< type, 4 > & get_synaptic_weights ( ) const

Returns the layer's synaptic weights.

Definition at line 1339 of file convolutional_layer.cpp.

◆ get_synaptic_weights_number()

Index get_synaptic_weights_number ( ) const
virtual

Returns the number of layer's synaptic weights.

Reimplemented from Layer.

Definition at line 1347 of file convolutional_layer.cpp.

◆ insert_gradient()

void insert_gradient ( LayerBackPropagation back_propagation,
const Index &  index,
Tensor< type, 1 > &  gradient 
) const
virtual

Reimplemented from Layer.

Definition at line 856 of file convolutional_layer.cpp.

◆ insert_padding()

void insert_padding ( const Tensor< type, 4 > &  inputs,
Tensor< type, 4 > &  padded_output 
)
Todo:
Add stride.

Definition at line 59 of file convolutional_layer.cpp.

◆ is_empty()

bool is_empty ( ) const

Returns a boolean, true if convolutional layer is empty and false otherwise.

Definition at line 46 of file convolutional_layer.cpp.

◆ set() [1/2]

void set ( const Tensor< Index, 1 > &  new_inputs_dimensions,
const Tensor< Index, 1 > &  new_kernels_dimensions 
)

Sets and initializes the layer's parameters in accordance with the dimensions taken as input. The initialization values are random values from a normal distribution.

Parameters
new_inputs_dimensionsA vector containing the desired inputs' dimensions (number of images, number of channels, rows number, columns number).
new_kernels_dimensionsA vector containing the desired kernels' dimensions (number of kernels, number of channels, rows number, columns number).

Definition at line 1100 of file convolutional_layer.cpp.

◆ set() [2/2]

void set ( const Tensor< type, 4 > &  new_inputs,
const Tensor< type, 4 > &  new_kernels,
const Tensor< type, 1 > &  new_biases 
)

Sets and initializes the layer's parameters in accordance with the dimensions taken as input. The initialization values are random values from a normal distribution.

Parameters
new_inputsLayer inputs.
new_kernelsLayer synaptic weights.
new_biasesLayer biases.

Definition at line 1156 of file convolutional_layer.cpp.

◆ set_activation_function()

void set_activation_function ( const ActivationFunction new_activation_function)

Sets the layer's activation function.

Parameters
new_activation_functionThe desired activation function.

Definition at line 1231 of file convolutional_layer.cpp.

◆ set_biases()

void set_biases ( const Tensor< type, 1 > &  new_biases)

Sets the layer's biases.

Parameters
new_biasesThe desired biases.

Definition at line 1240 of file convolutional_layer.cpp.

◆ set_biases_constant()

void set_biases_constant ( const type &  value)

Initializes the layer's biases to a given value.

Parameters
valueThe desired value.

Definition at line 1192 of file convolutional_layer.cpp.

◆ set_column_stride()

void set_column_stride ( const Index &  new_stride_column)

Sets the kernels' column stride.

Parameters
new_stride_rowThe desired column stride.

Definition at line 1281 of file convolutional_layer.cpp.

◆ set_convolution_type()

void set_convolution_type ( const ConvolutionType &  new_convolution_type)

Sets the padding option.

Parameters
new_convolution_typeThe desired convolution type.

Definition at line 1258 of file convolutional_layer.cpp.

◆ set_parameters()

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

Sets the synaptic weights and biases to the given values.

Parameters
new_parametersA vector containing the synaptic weights and biases, in this order.

Reimplemented from Layer.

Definition at line 1295 of file convolutional_layer.cpp.

◆ set_parameters_constant()

void set_parameters_constant ( const type &  value)
virtual

Initializes the layer's parameters to a given value.

Parameters
valueThe desired value.

Reimplemented from Layer.

Definition at line 1210 of file convolutional_layer.cpp.

◆ set_parameters_random()

void set_parameters_random ( )
virtual

Reimplemented from Layer.

Definition at line 1220 of file convolutional_layer.cpp.

◆ set_row_stride()

void set_row_stride ( const Index &  new_stride_row)

Sets the kernels' row stride.

Parameters
new_stride_rowThe desired row stride.

Definition at line 1267 of file convolutional_layer.cpp.

◆ set_synaptic_weights()

void set_synaptic_weights ( const Tensor< type, 4 > &  new_synaptic_weights)

Sets the layer's synaptic weights.

Parameters
new_synaptic_weightsThe desired synaptic weights.

Definition at line 1249 of file convolutional_layer.cpp.

◆ set_synaptic_weights_constant()

void set_synaptic_weights_constant ( const type &  value)

Initializes the layer's synaptic weights to a given value.

Parameters
valueThe desired value.

Definition at line 1201 of file convolutional_layer.cpp.

◆ to_2d()

void to_2d ( const Tensor< type, 4 > &  input_4d,
Tensor< type, 2 > &  output_2d 
) const

Definition at line 1377 of file convolutional_layer.cpp.

Member Data Documentation

◆ activation_function

ActivationFunction activation_function = ActivationFunction::RectifiedLinear
protected

Definition at line 227 of file convolutional_layer.h.

◆ biases

Tensor<type, 1> biases
protected

Bias is a neuron parameter that is summed with the neuron's weighted inputs and passed through the neuron's trabsfer function to generate the neuron's output.

Definition at line 217 of file convolutional_layer.h.

◆ column_stride

Index column_stride = 1
protected

Definition at line 221 of file convolutional_layer.h.

◆ convolution_type

ConvolutionType convolution_type = ConvolutionType::Valid
protected

Definition at line 225 of file convolutional_layer.h.

◆ input_variables_dimensions

Tensor<Index, 1> input_variables_dimensions
protected

Definition at line 223 of file convolutional_layer.h.

◆ row_stride

Index row_stride = 1
protected

Definition at line 219 of file convolutional_layer.h.

◆ synaptic_weights

Tensor<type, 4> synaptic_weights
protected

This tensor containing conection strengths from a layer's inputs to its neurons.

Definition at line 212 of file convolutional_layer.h.


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