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])
# 角度をラジアンに変換する例
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 リファレンスマニュアル