評價此頁

torch.deg2rad#

torch.deg2rad(input, *, out=None) Tensor#

返回一個新張量,其中input的每個元素都從角度(度)轉換為弧度。

引數

input (Tensor) – 輸入張量。

關鍵字引數

out (Tensor, optional) – 輸出張量。

示例

>>> a = torch.tensor([[180.0, -180.0], [360.0, -360.0], [90.0, -90.0]])
>>> torch.deg2rad(a)
tensor([[ 3.1416, -3.1416],
        [ 6.2832, -6.2832],
        [ 1.5708, -1.5708]])