torch.bitwise_and#
- torch.bitwise_and(input, other, *, out=None) Tensor#
計算
input和other的按位 AND。輸入張量必須是整數或布林型別。對於布林張量,它計算邏輯 AND。- 引數
input – 第一個輸入張量
other – 第二個輸入張量
- 關鍵字引數
out (Tensor, optional) – 輸出張量。
示例
>>> torch.bitwise_and(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8)) tensor([1, 0, 3], dtype=torch.int8) >>> torch.bitwise_and(torch.tensor([True, True, False]), torch.tensor([False, True, False])) tensor([ False, True, False])