PyTorch torch.ne 関数


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

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)

出力結果は次のとおりです:

tensor([False, False, True, False])

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

その他の拡張