hardsigmoid

dragon.vm.torch.nn.functional.hardsigmoid(
  input,
  inplace=False
)[source]

Apply the hard sigmoid function to input.

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} \]
Parameters:
  • input (dragon.vm.torch.Tensor) – The input tensor.
  • inplace (bool, optional, default=False) – Whether to do the operation in-place.
Returns:

dragon.vm.torch.Tensor – The output tensor.