mindspore.ops.Tan

class mindspore.ops.Tan[source]

Computes tangent of x element-wise.

\[out_i = tan(x_i)\]
Inputs:
  • x (Tensor) - The shape of tensor is \((N,*)\) where \(*\) means, any number of additional dimensions. Data type must be float16 or float32.

Outputs:

Tensor, has the same shape as x.

Raises
  • TypeError – If dtype of x is neither float16 nor float32.

  • 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]