torch.bitwise_not¶ torch.bitwise_not(input, *, out=None) → Tensor¶ 計算給定輸入張量的位元反相。輸入張量必須是整數或布林類型。對於布林張量,它計算邏輯 NOT。 參數 input (Tensor) – 輸入張量。 關鍵字參數 out (Tensor, optional) – 輸出張量。 範例 >>> torch.bitwise_not(torch.tensor([-1, -2, 3], dtype=torch.int8)) tensor([ 0, 1, -4], dtype=torch.int8)