PyTorch torch.div 関数
torch.divこれは、PyTorch で要素ごとの除算を実行するための関数です。
関数定義
torch.div(input, other, rounding_mode, out)
使用例
実例
import torch
a = torch.tensor([10, 20, 30])
b = torch.tensor([2, 4, 5])
# 要素ごとの除算
c = torch.div(a, b)
print(c)
a = torch.tensor([10, 20, 30])
b = torch.tensor([2, 4, 5])
# 要素ごとの除算
c = torch.div(a, b)
print(c)
出力結果は次のとおりです:
tensor([5., 5., 6.])
その他の拡張
Pytorch torch リファレンスマニュアル