快捷方式

torch.bitwise_left_shift

torch.bitwise_left_shift(input, other, *, out=None) Tensor

计算 inputother 位进行的算术左移。输入 Tensor 必须是整数类型。此操作符支持 广播到共同形状类型提升

应用的操作是

outi=inputi<<otheri\text{out}_i = \text{input}_i << \text{other}_i
参数
  • input (TensorScalar) – 第一个输入 Tensor

  • other (TensorScalar) – 第二个输入 Tensor

关键字参数

out (Tensor, 可选) – 输出 Tensor。

示例

>>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-2, -2, 24], dtype=torch.int8)

文档

查阅 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源