PyTorch torch.bitwise_not 関数
torch.bitwise_notPyTorch で要素ごとにビット単位の否定を実行する関数です。
関数定義
torch.bitwise_not(input, *, out=None)
使用例
例
import torch
# ビット単位の否定の例
x = torch.tensor([0, 1, 2, 3], dtype=torch.int8)
result = torch.bitwise_not(x)
print(result) # tensor([-1, -2, -3, -4], dtype=int8)
# ビット単位の否定の例
x = torch.tensor([0, 1, 2, 3], dtype=torch.int8)
result = torch.bitwise_not(x)
print(result) # tensor([-1, -2, -3, -4], dtype=int8)
その他の拡張
Pytorch torch リファレンスマニュアル