mindspore.ops.deg2rad
- mindspore.ops.deg2rad(x)[source]
Calculates a new tensor with each of the elements of x converted from angles in degrees to radians.
- Parameters
x (Tensor[Number]) – The input tensor. It must be a positive-definite matrix. With float16, float32 or float64 data type.
- Returns
Tensor, has the same dtype as the x.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> 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 ]]