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

torch.bitwise_or

torch.bitwise_or(input: Tensor, other: Tensor, *, out: Optional[Tensor]) Tensor

计算位运算或操作 inputother 。输入张量必须是整数或布尔类型。对于布尔张量,它执行逻辑或操作。

参数:
  • 输入 – 第一个输入张量

  • 其他 – 第二个输入张量

关键字参数:

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

示例:

>>> torch.bitwise_or(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-1, -2,  3], dtype=torch.int8)
>>> torch.bitwise_or(torch.tensor([True, True, False]), torch.tensor([False, True, False]))
tensor([ True, True, False])

© 版权所有 PyTorch 贡献者。

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

文档

PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源