Apply ReLU activation to 1D array
Computes: f = max(0,x)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(relu_actv_type), | intent(in) | :: | this |
ReLU activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Activated output values
function apply_relu(this, val) result(output) !! Apply ReLU activation to 1D array !! !! Computes: f = max(0,x) implicit none ! Arguments class(relu_actv_type), intent(in) :: this !! ReLU activation type type(array_type), intent(in) :: val !! Input values type(array_type), pointer :: output !! Activated output values if(this%apply_scaling)then output => max(val, this%threshold) * this%scale else output => max(val, this%threshold) end if end function apply_relu