TUTORIALAI 与数据科学FETCHED

PyTorch torch.deg2rad 函数

PyTorch torch.deg2rad 函数 PyTorch torch.deg2rad 函数 Pytorch torch 参考手册 torch.deg2rad 是 PyTorch 中用于将角度转换为弧度的函数。 函数定义 torch.deg2rad(input, *, out=None) 使用示例 实例 [mycode4 type='python'] import torch # 角度..

更新于 2026/7/16

教程详情页默认 noindex。

PyTorch torch.deg2rad 函数

PyTorch torch.deg2rad 函数


Pytorch torch 参考手册 Pytorch torch 参考手册

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])

Pytorch torch 参考手册 Pytorch torch 参考手册