Apply swish activation to 1D array
Computes: f(x) = x * sigmoid(βx) = x / (1 + exp(-βx))
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(swish_actv_type), | intent(in) | :: | this |
Swish activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Swish activation output
function apply_swish(this, val) result(output) !! Apply swish activation to 1D array !! !! Computes: f(x) = x * sigmoid(β*x) = x / (1 + exp(-β*x)) implicit none ! Arguments class(swish_actv_type), intent(in) :: this !! Swish activation type type(array_type), intent(in) :: val !! Input values type(array_type), pointer :: output !! Swish activation output ! Compute sigmoid(β*x) ! Compute swish: x * sigmoid(β*x) if(this%apply_scaling)then output => swish(val, this%beta) * this%scale else output => swish(val, this%beta) end if end function apply_swish