Module containing implementation of the piecewise activation function https://doi.org/10.48550/arXiv.1809.09534
Initialise a piecewise activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Optional scale factor for activation output |
|
| real(kind=real32), | intent(in), | optional | :: | gradient |
Optional gradient parameter for piecewise function |
|
| real(kind=real32), | intent(in), | optional | :: | limit |
Optional limit parameter for piecewise function -limit < x < limit |
|
| type(onnx_attribute_type), | intent(in), | optional, | dimension(:) | :: | attributes |
Optional array of ONNX attributes |
Piecewise activation type
Type for piecewise activation function with overloaded procedures
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | apply_scaling | = | .false. |
Boolean to apply scaling or not |
|
| real(kind=real32), | public | :: | gradient | ||||
| real(kind=real32), | public | :: | limit | ||||
| 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, gradient, limit, attributes) | Initialise a piecewise activation function |
| procedure, public, pass(this) :: apply => apply_piecewise | |
| procedure, public, pass(this) :: apply_attributes => apply_attributes_piecewise | |
| procedure, public, pass(this) :: export_attributes => export_attributes_piecewise | |
| procedure, public, pass(this) :: print_to_unit => print_to_unit_actv | |
| procedure, public, pass(this) :: reset => reset_piecewise |
Create piecewise 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 piecewise activation to 1D array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(piecewise_actv_type), | intent(in) | :: | this |
Piecewise activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Activated output values
Export piecewise activation function attributes as ONNX attributes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(piecewise_actv_type), | intent(in) | :: | this |
Piecewise activation type |
Array of ONNX attributes
Initialise a piecewise activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Optional scale factor for activation output |
|
| real(kind=real32), | intent(in), | optional | :: | gradient |
Optional gradient parameter for piecewise function |
|
| real(kind=real32), | intent(in), | optional | :: | limit |
Optional limit parameter for piecewise function -limit < x < limit |
|
| type(onnx_attribute_type), | intent(in), | optional, | dimension(:) | :: | attributes |
Optional array of ONNX attributes |
Piecewise activation type
Load ONNX attributes into piecewise activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(piecewise_actv_type), | intent(inout) | :: | this |
Piecewise activation type |
||
| type(onnx_attribute_type), | intent(in), | dimension(:) | :: | attributes |
Array of ONNX attributes |
Reset piecewise activation function attributes and variables
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(piecewise_actv_type), | intent(inout) | :: | this |
Piecewise activation type |