mindspore.numpy.tanh
- mindspore.numpy.tanh(x, dtype=None)[source]
Computes hyperbolic tangent element-wise.
Note
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
- Parameters
x (Tensor) – Input tensor.
dtype (
mindspore.dtype, optional) – Default:None. Overrides the dtype of the output Tensor.
- Returns
Tensor or scalar. This is a scalar if x is a scalar.
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore.numpy as np >>> x = np.arange(5).astype('float32') >>> print(np.tanh(x)) [0. 0.7615942 0.9640276 0.9950548 0.9993293]