mindspore.ops.Tan

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

Computes tangent of input_x element-wise.

\[out_i = tan(x_i)\]
Inputs:
  • input_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 input_x.

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

  • TypeError – If input_x is not a Tensor.

Supported Platforms:

Ascend CPU

Examples

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