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