Hardsigmoid¶
- class
dragon.vm.torch.nn.
Hardsigmoid
(inplace=False)[source]¶ Apply the hard sigmoid function.
The HardSigmoid function is defined as:
\[\text{Hardsigmoid}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ 1 & \text{if~} x \ge +3, \\ x / 6 + 1 / 2 & \text{otherwise} \end{cases} \]Examples:
m = torch.nn.Hardsigmoid() x = torch.randn(2, 3) y = m(x)
See also