|
FNN 1.0.0
Toolbox to use NNs in Fortran.
|
Module dedicated to the class sequentialneuralnetwork. More...
Data Types | |
| type | layercontainer |
| Layer container class. More... | |
| type | sequentialneuralnetwork |
| Implements a sequential neural network. More... | |
Module dedicated to the class sequentialneuralnetwork.
| type(sequentialneuralnetwork) function, public fnn_network_sequential::construct_sequential_neural_network | ( | integer(ik), intent(in) | batch_size, |
| integer(ik), dimension(:), intent(in) | internal_sizes, | ||
| character(len=*), dimension(:), intent(in) | activation_names, | ||
| character(len=*), dimension(:), intent(in) | initialisation_names | ||
| ) |
Manual constructor for class sequentialneuralnetwork. Only for testing purpose.
| [in] | batch_size | The value for sequentialneuralnetwork::batch_size. |
| [in] | internal_sizes | The list of internal sizes. |
| [in] | activation_names | The list of activation functions. |
| [in] | initialisation_names | The list of initialisations for model parameters. |
|
private |
Implements sequentialneuralnetwork::apply_adjoint.
Applies the adjoint of the network.
Note
If there is more than one layer, this method uses layer::adjoint_input as intermediate storage.
For this reason, the intent of self is declared inout. In addition, the intent of dy is declared intout because for certain layer classes (e.g. fnn_layer_dense::denselayer) the output perturbation gets overwritten in the process.
| [in,out] | self | The network. |
| [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 sequentialneuralnetwork::apply_forward.
Applies and linearises the network.
Note
If there is more than one layer, this method uses layer::forward_input as intermediate storage.
For the case of a fnn_layer_dense::denselayer, this means that the first step of denselayer::apply_forward consists in copying layer::forward_input into... layer::forward_input!
For theses reasons, and because the linearisation is stored inside the network, the intent of self is declared inout.
| [in,out] | self | The network. |
| [in] | train | Whether the model is used in training mode. |
| [in] | member | The index inside the batch. |
| [in] | x | The input of the network. |
| [out] | y | The output of the network. |
|
private |
Implements sequentialneuralnetwork::apply_tangent_linear.
Applies the TL of the network.
Note
If there is more than one layer, this method uses layer::tangent_linear_input as intermediate storage.
For this reason, the intent of self is declared inout.
| [in,out] | self | The network. |
| [in] | member | The index inside the batch. |
| [in] | dp | The parameter perturbation. |
| [in] | dx | The state perturbation. |
| [out] | dy | The output perturbation. |
| type(sequentialneuralnetwork) function, public fnn_network_sequential::snn_fromfile | ( | integer(ik), intent(in) | batch_size, |
| character(len=*), intent(in) | filename | ||
| ) |
Constructor for class sequentialneuralnetwork from a file.
| [in] | batch_size | The value for layer::batch_size. |
| [in] | filename | The name of the file to read. |
|
private |
Implements sequentialneuralnetwork::get_input_size.
Returns the input size of the network.
| [in] | self | The network. |
|
private |
Implements sequentialneuralnetwork::get_num_parameters.
Returns the number of parameters.
| [in] | self | The network. |
|
private |
Implements sequentialneuralnetwork::get_output_size.
Returns the output size of the network.
| [in] | self | The network. |
|
private |
Implements sequentialneuralnetwork::get_parameters.
Getter for the network's parameters.
| [in] | self | The network. |
| [out] | parameters | The vector of parameters. |
|
private |
Implements sequentialneuralnetwork::set_parameters.
Setter for the network's parameters.
| [in,out] | self | The network. |
| [in] | new_parameters | The new values for the parameters. |
|
private |
Implements sequentialneuralnetwork::tofile.
Saves the network.
| [in] | self | The network. |
| [in] | filename | The name of the file to write. |