評價此頁

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])