TUTORIALAI 与数据科学FETCHED
PyTorch torch.bitwise_left_shift 函数
PyTorch torch.bitwise_left_shift 函数 PyTorch torch.bitwise_left_shift 函数 Pytorch torch 参考手册 torch.bitwise_left_shift 是 PyTorch 中用于逐元素左移位的函数。 函数定义 torch.bitwise_left_shift(input, other, *, out=None) 使用示例 实例 [my..
更新于 2026/7/16
教程详情页默认 noindex。
PyTorch torch.bitwise_left_shift 函数
PyTorch torch.bitwise_left_shift 函数
torch.bitwise_left_shift 是 PyTorch 中用于逐元素左移位的函数。
函数定义
torch.bitwise_left_shift(input, other, *, out=None)
使用示例
实例
import torch
# 左移位示例
x = torch.tensor([1, 2, 3, 4], dtype=torch.int8)
result = torch.bitwise_left_shift(x, 1)
print(result) # tensor([2, 4, 6, 8], dtype=int8)
# 左移位示例
x = torch.tensor([1, 2, 3, 4], dtype=torch.int8)
result = torch.bitwise_left_shift(x, 1)
print(result) # tensor([2, 4, 6, 8], dtype=int8)
Pytorch torch 参考手册