Module containing implementation of the sigmoid activation function
This module implements the logistic sigmoid function that squashes inputs to the range (0, 1), commonly used for binary classification.
Mathematical operation:
Derivative:
Properties: Smooth, bounded , saturates for large Output interpretation: Can be viewed as probability for binary events
Initialise a sigmoid 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 |
Sigmoid activation type
Type for sigmoid activation function with overloaded procedures
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| 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 sigmoid activation function |
| procedure, public, pass(this) :: apply => apply_sigmoid | |
| procedure, public, pass(this) :: apply_attributes => apply_attributes_sigmoid | |
| procedure, public, pass(this) :: export_attributes => export_attributes_sigmoid | |
| procedure, public, pass(this) :: print_to_unit => print_to_unit_actv | |
| procedure, public, pass(this) :: reset => reset_sigmoid |
Create sigmoid 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
Apply sigmoid activation to 1D array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sigmoid_actv_type), | intent(in) | :: | this |
Sigmoid activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Activated output values in range [0,1]
Export sigmoid activation function attributes as ONNX attributes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sigmoid_actv_type), | intent(in) | :: | this |
Sigmoid activation type |
Array of ONNX attributes
Initialise a sigmoid 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 |
Sigmoid activation type
Load ONNX attributes into sigmoid activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sigmoid_actv_type), | intent(inout) | :: | this |
Sigmoid activation type |
||
| type(onnx_attribute_type), | intent(in), | dimension(:) | :: | attributes |
Array of ONNX attributes |
Reset sigmoid activation function attributes and variables
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sigmoid_actv_type), | intent(inout) | :: | this |
Sigmoid activation type |