mindspore.mint.nn.Hardsigmoid
- class mindspore.mint.nn.Hardsigmoid
Applies Hard Sigmoid activation function element-wise.
Hard Sigmoid is defined as:
Hardsigmoid Activation Function Graph:
- Inputs:
input (Tensor) - The input of Hardsigmoid.
- Outputs:
Tensor, with the same type and shape as the input.
- Supported Platforms:
Ascend
Examples
>>> import mindspore >>> from mindspore import Tensor, mint >>> import numpy as np >>> input = Tensor(np.array([-1, -2, 0, 2, 1]), mindspore.float16) >>> hsigmoid = mint.nn.Hardsigmoid() >>> result = hsigmoid(input) >>> print(result) [0.3333 0.1666 0.5 0.8335 0.6665]