mindspore.ops.hardsigmoid
- mindspore.ops.hardsigmoid(input)[source]
Hard sigmoid activation function.
Applies hard sigmoid activation element-wise. The input is a Tensor with any valid shape.
Hard sigmoid is defined as:
where
is an element of the input Tensor.- Parameters
input (Tensor) – Hard Sigmoid input, with float16, float32 or float64 data type.
- Returns
A Tensor whose dtype and shape are the same as input.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([ -3.5, 0, 4.3]), mindspore.float32) >>> output = ops.hardsigmoid(x) >>> print(output) [0. 0.5 1. ]