PyTorch torch.eq 関数


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

torch.eqこれは、PyTorch において要素ごとの等価比較を行うための関数です。

関数定義

torch.eq(input, other, out)

使用例

例

import torch

a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([1, 2, 0, 4])

result = torch.eq(a, b)

print(result)

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

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

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

その他の拡張