mindspore.ops.deg2rad

View Source On Gitee
mindspore.ops.deg2rad(x)[source]

Converts angles in degrees to angles in radians element-wise.

Parameters

x (Tensor) – The input tensor. With float16, float32 or float64 data type.

Returns

Tensor, has the same dtype as the x.

Raises
  • TypeError – If x is not a Tensor.

  • TypeError – If dtype of x isn't float16, float32 or float64.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([[90.0, -90.0], [180.0, -180.0], [270.0, -270.0]]).astype(np.float32))
>>> output = ops.deg2rad(x)
>>> print(output)
[[ 1.5707964 -1.5707964]
 [ 3.1415927 -3.1415927]
 [ 4.712389  -4.712389 ]]