PyTorch torch.negative 関数
torch.negativePyTorch で要素ごとに負を取る関数であり、torch.neg機能が同じです。
関数定義
torch.negative(input, out=None)
使用例
実例
import torch
# 要素ごとに負を取る
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.negative(x)
print(result)
# 要素ごとに負を取る
x = torch.tensor([1.0, 2.0, 3.0])
result = torch.negative(x)
print(result)
その他の拡張
Pytorch torch リファレンスマニュアル