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