PyTorch torch.multiply 関数
torch.multiplyは、PyTorch において要素ごとの乗算を行うための関数です。torch.mul機能は同じです。
関数定義
torch.multiply(input, other, out=None)
使用例
例
import torch
# 要素ごとの乗算
x = torch.tensor([1.0, 2.0, 3.0])
y = torch.tensor([4.0, 5.0, 6.0])
result = torch.multiply(x, y)
print(result)
# 要素ごとの乗算
x = torch.tensor([1.0, 2.0, 3.0])
y = torch.tensor([4.0, 5.0, 6.0])
result = torch.multiply(x, y)
print(result)
その他の拡張
Pytorch torch リファレンスマニュアル