mindspore.ops.Tan

class mindspore.ops.Tan(*args, **kwargs)[source]

Computes tangent of x element-wise.

\[out_i = tan(x_i)\]
Inputs:
  • x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\). Data type must be float16, float32 or int32.

Outputs:

Tensor, has the same shape as x.

Raises
  • TypeError – If dtype of x is not one of the following: float16, float32, int32.

  • TypeError – If x is not a Tensor.

Supported Platforms:

Ascend CPU

Examples

>>> tan = ops.Tan()
>>> x = Tensor(np.array([-1.0, 0.0, 1.0]), mindspore.float32)
>>> output = tan(x)
>>> print(output)
[-1.5574081 0. 1.5574081]