PyTorch torch.bitwise_not 関数

PyTorch torch.bitwise_not 関数


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

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)

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

その他の拡張