• 文档 >
  • torch >
  • torch.bitwise_right_shift
快捷键

torch.bitwise_right_shift

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

计算右算术移位,输入张量必须是整型。此运算符支持广播到公共形状和类型提升。在任何情况下,如果右操作数的值为负数或大于或等于提升后的左操作数的位数,则行为未定义。

使用的操作是:

outi=inputi>>otheri\text{out}_i = \text{input}_i >> \text{other}_i
参数:
  • 输入(张量或标量)- 第一个输入张量

  • 其他(张量或标量)- 第二个输入张量

关键字参数:

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

示例:

>>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-1, -7,  3], dtype=torch.int8)

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,主题由 Read the Docs 提供。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源