torch.bitwise_not¶ torch.bitwise_not(input, *, out=None) → Tensor¶ 計算給定輸入張量的按位非 (bitwise NOT)。輸入張量必須是整數型別或布林型別。對於布林張量,它計算邏輯非 (logical NOT)。 引數 input (Tensor) – 輸入張量。 關鍵詞引數 out (Tensor, optional) – 輸出張量。 示例 >>> torch.bitwise_not(torch.tensor([-1, -2, 3], dtype=torch.int8)) tensor([ 0, 1, -4], dtype=torch.int8)