mindspore.ops.SoftShrink

class mindspore.ops.SoftShrink[源代码]

Soft Shrink激活函数。

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

支持平台:

Ascend CPU GPU

样例:

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input_x = Tensor(np.array([[ 0.5297,  0.7871,  1.1754], [ 0.7836,  0.6218, -1.1542]]), mindspore.float16)
>>> softshrink = ops.SoftShrink()
>>> output = softshrink(input_x)
>>> print(output)
[[ 0.02979  0.287    0.676  ]
 [ 0.2837   0.1216  -0.6543 ]]