PyTorch torch.negative 関数


Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

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)

Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

その他の拡張