Module containing implementation of the leaky ReLU activation function
This module implements Leaky ReLU, a variant of ReLU that allows small negative values to prevent "dying ReLU" problem.
Mathematical operation:
where is a small positive constant (typically 0.01 or 0.2)
Derivative:
Properties: Non-saturating, allows gradient flow for negative inputs Reference: Maas et al. (2013), ICML
Initialise a leaky ReLU activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Optional scale factor for activation output |
|
| type(onnx_attribute_type), | intent(in), | optional, | dimension(:) | :: | attributes |
Optional array of ONNX attributes |
Leaky ReLU activation type
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real32), | public | :: | alpha | ||||
| logical, | public | :: | apply_scaling | = | .false. |
Boolean to apply scaling or not |
|
| character(len=10), | public | :: | name |
Name of the activation function |
|||
| real(kind=real32), | public | :: | scale | = | 1._real32 |
Scale of the activation function |
|
| real(kind=real32), | public | :: | threshold |
Threshold of the activation function |
| private function initialise (scale, attributes) | Initialise a leaky ReLU activation function |
| procedure, public, pass(this) :: apply => leaky_relu_activate | |
| procedure, public, pass(this) :: apply_attributes => apply_attributes_leaky_relu | |
| procedure, public, pass(this) :: export_attributes => export_attributes_leaky_relu | |
| procedure, public, pass(this) :: print_to_unit => print_to_unit_actv | |
| procedure, public, pass(this) :: reset => leaky_relu_reset |
Create leaky ReLU activation function from ONNX attributes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(onnx_attribute_type), | intent(in), | dimension(:) | :: | attributes |
Array of ONNX attributes |
Instance of activation type
Export leaky ReLU activation function attributes as ONNX attributes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(leaky_relu_actv_type), | intent(in) | :: | this |
Leaky ReLU activation type |
Array of ONNX attributes
Initialise a leaky ReLU activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Optional scale factor for activation output |
|
| type(onnx_attribute_type), | intent(in), | optional, | dimension(:) | :: | attributes |
Optional array of ONNX attributes |
Leaky ReLU activation type
Apply leaky ReLU activation to 1D array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(leaky_relu_actv_type), | intent(in) | :: | this |
Leaky ReLU activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Activated output values
Load ONNX attributes into leaky ReLU activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(leaky_relu_actv_type), | intent(inout) | :: | this |
Leaky ReLU activation type |
||
| type(onnx_attribute_type), | intent(in), | dimension(:) | :: | attributes |
Array of ONNX attributes |
Reset leaky ReLU activation function attributes and variables
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(leaky_relu_actv_type), | intent(inout) | :: | this |
Leaky ReLU activation type |