ReLU

class dragon.vm.torch.nn.ReLU(inplace=False)[source]

Apply rectified linear unit. [Nair & Hinton, 2010].

The ReLU function is defined as:

\[\text{ReLU}(x) = \begin{cases} x, & \text{ if } x \geq 0 \\ 0, & \text{ otherwise } \end{cases} \]

Examples:

m = torch.nn.ReLU()
x = torch.randn(2, 3)
y = m(x)

__init__

ReLU.__init__(inplace=False)[source]

Create a ReLU module.

Parameters:
  • inplace (bool, optional, default=False) Whether to do the operation in-place.