mindspore.ops.tanhshrink
- mindspore.ops.tanhshrink(input)[source]
Tanhshrink Activation, \(Tanhshrink(x)=x-Tanh(x)\) , where \(x\) corresponds to input . See
mindspore.nn.Tanhshrink
for more details.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore as ms >>> import mindspore.ops as ops >>> from mindspore import Tensor >>> import numpy as np >>> input = Tensor(np.array([1, 2, 3, 2, 1]), ms.float16) >>> output = ops.tanhshrink(input) >>> print(output) [0.2383 1.036 2.004 1.036 0.2383]