mindspore.ops.Softsign

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

Softsign activation function.

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

Inputs:
  • input_x (Tensor) - Tensor of shape \((N, *)\), where \(*\) means, any number of additional dimensions, with float16 or float32 data type.

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
>>> input_x = Tensor(np.array([0, -1, 2, 30, -30]), mindspore.float32)
>>> softsign = ops.Softsign()
>>> output = softsign(input_x)
>>> print(output)
[ 0.        -0.5         0.6666667  0.9677419 -0.9677419]