mindspore.ops.HSigmoid

View Source On Gitee
class mindspore.ops.HSigmoid[source]

Hard sigmoid activation function.

Refer to mindspore.ops.hardsigmoid() for more details.

Inputs:
  • input_x (Tensor) - The input Tensor.

Outputs:

Tensor, with the same type and shape as the input_x.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> hsigmoid = ops.HSigmoid()
>>> input_x = Tensor(np.array([-1, -2, 0, 2, 1]), mindspore.float16)
>>> result = hsigmoid(input_x)
>>> print(result)
[0.3333 0.1666 0.5    0.8335 0.6665]