快捷方式

torch.bitwise_left_shift

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

计算 inputother 位进行左算术位移的结果。输入张量必须为整数类型。此运算符支持广播到通用形状类型提升

应用的操作是

outi=inputi<<otheri\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)

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源