快捷方式

torch.bitwise_xor

torch.bitwise_xor(input, other, *, out=None) Tensor

計算 inputother 的按位異或。輸入張量必須是整數或布林型別。對於布林張量,它計算邏輯異或。

引數
  • input – 第一個輸入張量

  • other – 第二個輸入張量

關鍵字引數

out (Tensor, 可選) – 輸出張量。

示例

>>> torch.bitwise_xor(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-2, -2,  0], dtype=torch.int8)
>>> torch.bitwise_xor(torch.tensor([True, True, False]), torch.tensor([False, True, False]))
tensor([ True, False, False])

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

獲取適合初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源