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 参考手册