Hardswish¶
- class
dragon.vm.torch.nn.
Hardswish
[source]¶ Apply the hard swish function. [Howard et.al, 2019].
The HardSwish function is defined as:
\[\text{Hardsigmoid}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ x & \text{if~} x \ge +3, \\ x \cdot (x + 3) /6 & \text{otherwise} \end{cases} \]Examples:
m = torch.nn.Hardswish() x = torch.randn(2, 3) y = m(x)
See also