PyTorch torch.bitwise_right_shift 関数
torch.bitwise_right_shiftは PyTorch で要素ごとに右シフトするための関数です。
関数定義
torch.bitwise_right_shift(input, other, *, out=None)
使用例
サンプル
import torch
# 右シフトの例
x = torch.tensor([2, 4, 6, 8], dtype=torch.int8)
result = torch.bitwise_right_shift(x, 1)
print(result) # tensor([1, 2, 3, 4], dtype=int8)
# 右シフトの例
x = torch.tensor([2, 4, 6, 8], dtype=torch.int8)
result = torch.bitwise_right_shift(x, 1)
print(result) # tensor([1, 2, 3, 4], dtype=int8)
その他の拡張
Pytorch torch リファレンスマニュアル