PyTorch torch.ne 関数
torch.nePyTorch で要素ごとに不等比較を行うための関数です。
関数定義
torch.ne(input, other, out)
使用例
例
import torch
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([1, 2, 0, 4])
result = torch.ne(a, b)
print(result)
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([1, 2, 0, 4])
result = torch.ne(a, b)
print(result)
出力結果は次のとおりです:
tensor([False, False, True, False])
その他の拡張
Pytorch torch リファレンスマニュアル