relu

dragon.nn.relu(
  inputs,
  inplace=False,
  **kwargs
)[source]

Apply the 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:

x = dragon.constant([-1., 0., 1.])
print(dragon.nn.relu(x))
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • inplace (bool, optional, default=False) – Call in-place or return a new tensor.
Returns:

dragon.Tensor – The output tensor.