relu_prime Function

public pure function relu_prime(x) result(res)

First derivative of the REctified Linear Unit (RELU) activation function.

Arguments

Type IntentOptional AttributesName
real(kind=rk), intent(in) :: x(:)

Return Value real(kind=rk) (size(x))


Contents

Source Code


Source Code

  pure function relu_prime(x) result(res)
    !! First derivative of the REctified Linear Unit (RELU) activation function.
    real(rk), intent(in) :: x(:)
    real(rk) :: res(size(x))
    where (x > 0)
      res = 1
    elsewhere
      res = 0
    end where
  end function relu_prime