快捷方式

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)

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

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

檢視資源