捷徑

torch.bitwise_or

torch.bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) Tensor

計算 inputother 的位元 OR 運算。輸入張量必須是整數或布林類型。對於布林張量,它計算邏輯 OR 運算。

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

  • other – 第二個輸入張量

關鍵字參數

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

範例

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

文件

取得 PyTorch 完整的開發者文件

檢視文件

教學

取得針對初學者和高級開發者的深入教學

檢視教學

資源

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

檢視資源