PyTorch torch.bitwise_and 関数

PyTorch torch.bitwise_and 関数


Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

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)

Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

その他の拡張