maxframe.tensor.radians#
- maxframe.tensor.radians(x, out=None, where=None, **kwargs)[源代码]#
将角度从度数转换为弧度。
- 参数:
x (array_like) -- 以度为单位的输入张量。
out (Tensor, None, or tuple of Tensor and None, optional) -- 用于存储结果的位置。如果提供了该参数,其形状必须与输入广播兼容。如果未提供或为 None,则返回一个新分配的张量。元组(只能作为关键字参数)的长度必须等于输出的数量。
where (array_like, optional) -- 值为 True 表示在该位置计算 ufunc,值为 False 表示保留输出中的值不变。
**kwargs
- 返回:
y -- 对应的弧度值。
- 返回类型:
Tensor
参见
deg2rad等效函数
示例
将度数数组转换为弧度
>>> import maxframe.tensor as mt
>>> deg = mt.arange(12.) * 30. >>> mt.radians(deg).execute() array([ 0. , 0.52359878, 1.04719755, 1.57079633, 2.0943951 , 2.61799388, 3.14159265, 3.66519143, 4.1887902 , 4.71238898, 5.23598776, 5.75958653])
>>> out = mt.zeros((deg.shape)) >>> ret = mt.radians(deg, out) >>> ret is out True