Apply piecewise activation to 1D array
Computes piecewise function: f = 0 if x ≤ min f = scale if x ≥ max f = scale * x + intercept otherwise
| 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
function apply_piecewise(this, val) result(output) !! Apply piecewise activation to 1D array !! !! Computes piecewise function: !! f = 0 if x ≤ min !! f = scale if x ≥ max !! f = scale * x + intercept otherwise implicit none ! Arguments class(piecewise_actv_type), intent(in) :: this !! Piecewise activation type type(array_type), intent(in) :: val !! Input values type(array_type), pointer :: output !! Activated output values if(this%apply_scaling)then output => piecewise(val, this%gradient, this%limit) * this%scale else output => piecewise(val, this%gradient, this%limit) end if end function apply_piecewise