hardswish

dragon.nn.hardswish(
  inputs,
  **kwargs
)[source]

Apply the hard swish function. [Howard et.al, 2019].

The HardSwish function is defined as:

\[\text{HardSwish}(x) = x \cdot \max(0, \min(1, \frac{x}{6} + 0.5)) \]

Examples:

x = dragon.constant([-3., -1., 0., 1., 3.])
print(dragon.nn.hardswish(x))
Parameters:
Returns:

dragon.Tensor – The output tensor.