Apply tanh activation to 1D array
Applies the hyperbolic tangent function element-wise to input array: f = (exp(x) - exp(-x))/(exp(x) + exp(-x))
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(tanh_actv_type), | intent(in) | :: | this |
Tanh activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Activated output values
function apply_tanh(this, val) result(output) !! Apply tanh activation to 1D array !! !! Applies the hyperbolic tangent function element-wise to input array: !! f = (exp(x) - exp(-x))/(exp(x) + exp(-x)) implicit none ! Arguments class(tanh_actv_type), intent(in) :: this !! Tanh activation type type(array_type), intent(in) :: val !! Input values type(array_type), pointer :: output !! Activated output values if(this%apply_scaling)then output => tanh(val) * this%scale else output => tanh(val) end if end function apply_tanh