relu6#
- class saiunit.math.relu6(x, unit_to_scale=None)#
Rectified Linear Unit 6 activation function.
Computes the element-wise function
\[\mathrm{relu6}(x) = \min(\max(x, 0), 6)\]except under differentiation, we take:
\[\nabla \mathrm{relu}(0) = 0\]and
\[\nabla \mathrm{relu}(6) = 0\]- Parameters:
- Returns:
out – An array with the same shape as x, clipped to the range [0, 6].
- Return type:
Array
Examples
>>> import jax.numpy as jnp >>> import saiunit.math as sumath >>> sumath.relu6(jnp.array([-1., 0., 3., 7.])) Array([0., 0., 3., 6.], dtype=float32)