PyTorch torch.deg2rad 函数

约 335 字 更新于 2026-11-18 5iyo.com
PyTorch torch.deg2rad 函数

PyTorch torch.deg2rad 函数


torch.deg2rad 是 PyTorch 中用于将角度转换为弧度的函数。

函数定义

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

使用示例

实例

import torch

# 角度转弧度示例
x = torch.tensor([0, 90, 180, 270, 360], dtype=torch.float32)
result = torch.deg2rad(x)
print(result)  # tensor([0.0000, 1.5708, 3.1416, 4.7124, 6.2832])