mindspore.ops.coo_softsign

View Source On Gitee
mindspore.ops.coo_softsign(x: COOTensor)[source]

Softsign activation function.

The function is shown as follows:

\[\text{SoftSign}(x) = \frac{x}{1 + |x|}\]
Parameters

x (COOTensor) – Input COOTensor, with float16 or float32 data type.

Returns

COOTensor, with the same type and shape as the x.

Raises
  • TypeError – If x is not a COOTensor.

  • TypeError – If dtype of x is neither float16 nor float32.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import dtype as mstype
>>> from mindspore import Tensor, ops, COOTensor
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
>>> values = Tensor([-1, 2], dtype=mstype.float32)
>>> shape = (3, 4)
>>> x = COOTensor(indices, values, shape)
>>> output = ops.coo_softsign(x)
>>> print(output.values)
[-0.5        0.6666667]