torch.bitwise_left_shift

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

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

执行的操作是:

$\text{out}_i = \text{input}_i << \text{other}_i$
参数
  • input (TensorScalar) – 输入的第一个张量

  • other (TensorScalar) – 输入的第二个张量

关键字参数

out (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)
本页目录