nn_relu function

ReLU module

ReLU module

Applies the rectified linear unit function element-wise [REMOVE_ME]\mboxReLU(x)=(x)+=max(0,x)[REMOVEME2] \mbox{ReLU}(x) = (x)^+ = \max(0, x) [REMOVE_ME_2]

nn_relu(inplace = FALSE)

Arguments

  • inplace: can optionally do the operation in-place. Default: FALSE

Description

Applies the rectified linear unit function element-wise

\mboxReLU(x)=(x)+=max(0,x) \mbox{ReLU}(x) = (x)^+ = \max(0, x)

Shape

  • Input: (N,)(N, *) where * means, any number of additional dimensions
  • Output: (N,)(N, *), same shape as the input

Examples

if (torch_is_installed()) { m <- nn_relu() input <- torch_randn(2) m(input) }
  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14