FNN 1.0.0
Toolbox to use NNs in Fortran.
|
Module dedicated to the class linearactivation. More...
Data Types | |
type | linearactivation |
Base class for all activation functions. Implements a linear activation function. More... | |
Functions/Subroutines | |
type(linearactivation) function, public | construct_linear_activation (self_size, batch_size) |
Constructor for class linearactivation. More... | |
subroutine | linear_tofile (self, unit_num) |
Implements linearactivation::tofile. More... | |
subroutine | linear_apply_forward (self, member, z, y) |
Implements linearactivation::apply_forward. More... | |
subroutine | linear_apply_tangent_linear (self, member, dz, dy) |
Implements linearactivation::apply_tangent_linear. More... | |
subroutine | linear_apply_adjoint (self, member, dy, dz) |
Implements linearactivation::apply_adjoint. More... | |
Module dedicated to the class linearactivation.
type(linearactivation) function, public fnn_activation_linear::construct_linear_activation | ( | integer(ik), intent(in) | self_size, |
integer(ik), intent(in) | batch_size | ||
) |
Constructor for class linearactivation.
[in] | self_size | The value for linearactivation::self_size. |
[in] | batch_size | The value for linearactivation::batch_size. |
|
private |
Implements linearactivation::apply_adjoint.
Applies the adjoint of the activation function.
The adjoint operator reads
Note
In principle, this method should only be called after linearactivation::apply_forward, where the linearisation is computed.
This method supports inplace operations: it can be called with dz
= dy
.
[in] | self | The activation function. |
[in] | member | The index inside the batch. |
[in] | dy | The input of the adjoint operator. |
[out] | dz | The output of the adjoint operator. |
|
private |
Implements linearactivation::apply_forward.
Applies and linearises the activation function.
The activation function reads
and the associated linearisation reads
which is trivial and does not require any operation.
Note
Input parameter member
should be less than linearactivation::batch_size.
This method supports inplace operations: it can be called with y
= z
.
The intent for self
is declared inout
instead of in
because, for certain subclasses (e.g. fnn_activation_tanh::tanhactivation) the linearisation is stored inside the activation function.
[in,out] | self | The activation function. |
[in] | member | The index inside the batch. |
[in] | z | The input of the activation function. |
[out] | y | The output of the activation function. |
|
private |
Implements linearactivation::apply_tangent_linear.
Applies the TL of the activation function.
The TL operator reads
Note
In principle, this method should only be called after linearactivation::apply_forward, where the linearisation is computed.
This method supports inplace operations: it can be called with dy
= dz
.
[in] | self | The activation function. |
[in] | member | The index inside the batch. |
[in] | dz | The input of the TL operator. |
[out] | dy | The output of the TL operator. |
|
private |
Implements linearactivation::tofile.
Saves the activation function.
[in] | self | The activation function to save. |
[in] | unit_num | The unit number for the write statement. |