hard_silu#
- class brainunit.math.hard_silu(x, unit_to_scale=None)#
Hard SiLU (swish) activation function.
Computes the element-wise function
\[\mathrm{hard\_silu}(x) = x \cdot \mathrm{hard\_sigmoid}(x)\]Both
hard_silu()andhard_swish()are aliases for the same function.- Parameters:
- Returns:
out – An array with the same shape as x.
- Return type:
Array
Examples
>>> import jax.numpy as jnp >>> import saiunit.math as sumath >>> sumath.hard_silu(jnp.array([-4., 0., 4.])) Array([-0., 0., 4.], dtype=float32)