FNN 1.0.0
Toolbox to use NNs in Fortran.
|
Module dedicated to the class denselayer. More...
Data Types | |
type | denselayer |
Implements a dense (fully-connected) layer. More... | |
Functions/Subroutines | |
type(denselayer) function, public | construct_dense_layer (input_size, output_size, batch_size, activation_name, initialisation_name) |
Manual constructor for class denselayer. Only for testing purpose. More... | |
type(denselayer) function, public | dense_layer_fromfile (batch_size, unit_num) |
Constructor for class denselayer from a file. More... | |
subroutine | dense_tofile (self, unit_num) |
Implements denselayer::tofile. More... | |
subroutine | dense_apply_forward (self, train, member, x, y) |
Implements denselayer::apply_forward. More... | |
subroutine | dense_apply_tangent_linear (self, member, dp, dx, dy) |
Implements denselayer::apply_tangent_linear. More... | |
subroutine | dense_apply_adjoint (self, member, dy, dp, dx) |
Implements denselayer::apply_adjoint. More... | |
Module dedicated to the class denselayer.
type(denselayer) function, public fnn_layer_dense::construct_dense_layer | ( | integer(ik), intent(in) | input_size, |
integer(ik), intent(in) | output_size, | ||
integer(ik), intent(in) | batch_size, | ||
character(len=*), intent(in) | activation_name, | ||
character(len=*), intent(in) | initialisation_name | ||
) |
Manual constructor for class denselayer. Only for testing purpose.
[in] | input_size | The value for layer::input_size. |
[in] | output_size | The value for layer::output_size. |
[in] | batch_size | The value for layer::batch_size. |
[in] | activation_name | The activation function. |
[in] | initialisation_name | The initialisation for model parameters. |
|
private |
Implements denselayer::apply_adjoint.
Applies the adjoint of the layer.
The adjoint operator is implemented by
Note
This method should only be called after denselayer::apply_forward.
The value of
For this reason, the intent of dy
is declared inout
.
[in,out] | self | The layer. |
[in] | member | The index inside the batch. |
[in,out] | dy | The output perturbation. |
[out] | dp | The parameter perturbation. |
[out] | dx | The state perturbation. |
|
private |
Implements denselayer::apply_forward.
Applies and linearises the layer.
The forward function reads
where
Note
Input parameter member
should be less than layer::batch_size.
The linearisation of the regression
Because the linearisation of the layer is stored inside the layer, the intent of self
is declared inout
.
[in,out] | self | The layer. |
[in] | train | Whether the model is used in training mode. |
[in] | member | The index inside the batch. |
[in] | x | The input of the layer. |
[out] | y | The output of the layer. |
|
private |
Implements denselayer::apply_tangent_linear.
Applies the TL of the layer.
The TL operator reads
which is implemented by
Note
This method should only be called after denselayer::apply_forward.
[in] | self | The layer. |
[in] | member | The index inside the batch. |
[in] | dp | The parameter perturbation. |
[in] | dx | The state perturbation. |
[out] | dy | The output perturbation. |
type(denselayer) function, public fnn_layer_dense::dense_layer_fromfile | ( | integer(ik), intent(in) | batch_size, |
integer(ik), intent(in) | unit_num | ||
) |
Constructor for class denselayer from a file.
[in] | batch_size | The value for layer::batch_size. |
[in] | unit_num | The unit number for the read statements. |
|
private |
Implements denselayer::tofile.
Saves the layer.
[in] | self | The layer. |
[in] | unit_num | The unit number for the write statement. |