捷徑

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)

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

取得針對初學者和進階開發者的深度教學

檢視教學

資源

尋找開發資源並獲得您問題的解答

檢視資源