mindspore.numpy.deg2rad

mindspore.numpy.deg2rad(x, dtype=None)[source]

Converts angles from degrees to radians.

Parameters
  • x (Tensor) – Angles in degrees.

  • dtype (mindspore.dtype, optional) – defaults to None. Overrides the dtype of the output Tensor.

Returns

Tensor, the corresponding angle in radians. This is a tensor scalar if x is a tensor scalar.

Raises

TypeError – if x is not a tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> x = np.asarray([1, 2, 3, -4, -5])
>>> output = np.deg2rad(x)
>>> print(output)
[ 0.01745329  0.03490658  0.05235988 -0.06981317 -0.08726647]