mindspore.Tensor.tan

Tensor.tan(self) Tensor

Computes tangent of self element-wise.

\[out_i = \tan(input_i)\]
Returns

Tensor, has the same shape as self. The dtype of output is float32 when dtype of self is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as self.

Raises

TypeError – If self is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([-1.0, 0.0, 1.0]), mindspore.float32)
>>> output = input.tan()
>>> print(output)
[-1.5574077 0. 1.5574077]