torch.ne¶ torch.ne(input, other, *, out=None) → 張量¶ 逐元素計算 input≠other\text{input} \neq \text{other}input=other 。 第二個引數可以是一個數或形狀與第一個引數可 廣播 的張量。 引數 input (張量) – 待比較的張量 other (張量 或 浮點數) – 待比較的張量或值 關鍵字引數 out (張量, 可選) – 輸出張量。 返回 一個布林張量,在 input 不等於 other 的地方為 True,在其他地方為 False 示例 >>> torch.ne(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) tensor([[False, True], [True, False]])