PyTorch torch.bitwise_and 関数
torch.bitwise_andPyTorch において、要素ごとにビット単位 AND を行う関数です。
関数定義
torch.bitwise_and(input, other, *, out=None)
使用例
実例
import torch
# ビット単位ANDの例
x = torch.tensor([5, 3, 7], dtype=torch.int8)
y = torch.tensor([1, 3, 4], dtype=torch.int8)
result = torch.bitwise_and(x, y)
print(result) # tensor([1, 3, 4], dtype=int8)
# ビット単位ANDの例
x = torch.tensor([5, 3, 7], dtype=torch.int8)
y = torch.tensor([1, 3, 4], dtype=torch.int8)
result = torch.bitwise_and(x, y)
print(result) # tensor([1, 3, 4], dtype=int8)
その他の拡張
Pytorch torch リファレンスマニュアル