First derivative of the tanh activation function.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rk), | intent(in) | :: | x(:) |
pure function tanh_prime(x) result(res)
!! First derivative of the tanh activation function.
real(rk), intent(in) :: x(:)
real(rk) :: res(size(x))
res = 1 - tanh(x)**2
end function tanh_prime