relu6

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

Apply the clipped-6 rectified linear unit. [Krizhevsky, 2010].

The ReLU-6 function is defined as:

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

Examples:

x = dragon.constant([-1., 0., 7.])
print(dragon.nn.relu6(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.