mindspore.numpy.deg2rad
- mindspore.numpy.deg2rad(x, dtype=None)[源代码]
Converts angles from degrees to radians.
- 参数
x (Tensor) – Angles in degrees.
dtype (
mindspore.dtype
, optional) – Defaults to None. Overrides the dtype of the output Tensor.
- 返回
Tensor, the corresponding angle in radians. This is a tensor scalar if x is a tensor scalar.
- 异常
TypeError – If x is not a tensor.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> 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]