Shortcuts

torch.bitwise_left_shift

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

计算 input 的左算术移位,移位位数为 other。 输入张量必须是整数类型。此操作符支持 广播到共同形状类型提升

应用的操作是:

outi=inputi<<otheri\text{out}_i = \text{input}_i << \text{other}_i
Parameters
  • 输入 (张量标量) – 第一个输入张量

  • 其他 (Tensor标量) – 第二个输入张量

Keyword Arguments

输出 (张量, 可选) – 输出张量。

示例:

>>> 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)