torch.eq 产生相同的结果。因此,如果您出于某种原因更喜欢: >>> torch.eq(A, B).sum() tensor(3). 关于python - 比较张量中相等元素的数量,我们在Stack Overflow上 ...
確定! 回上一頁