mindspore.nn.Softsign

class mindspore.nn.Softsign[源代码]

Softsign激活函数。

Softsign函数图:

../../_images/Softsign.png

更多参考详见 mindspore.ops.softsign()

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> from mindspore import Tensor, nn
>>> import numpy as np
>>> x = Tensor(np.array([0, -1, 2, 30, -30]), mindspore.float32)
>>> softsign = nn.Softsign()
>>> output = softsign(x)
>>> print(output)
[ 0.        -0.5         0.6666667  0.9677419 -0.9677419]