mindspore.ops.Tanh
- class mindspore.ops.Tanh[source]
Computes hyperbolic tangent of input element-wise.
Refer to
mindspore.ops.tanh()
for more details.- Inputs:
input_x (Tensor) - Input Tensor of any dimension.
- 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([1, 2, 3, 4, 5]), mindspore.float32) >>> tanh = ops.Tanh() >>> output = tanh(input_x) >>> print(output) [0.7615941 0.9640276 0.9950547 0.9993293 0.9999092]