mindspore.ops.bitwise_or
- mindspore.ops.bitwise_or(input, other)[源代码]
逐元素对两个输入tensor做或运算。 如果 input 和 other 数据类型不同,遵循隐式类型转换规则、类型提升规则。
- 参数:
input (Tensor) - 第一个输入tensor。
other (Tensor) - 第二个输入tensor。
- 返回:
Tensor
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input = mindspore.tensor([-1, -2, 3]) >>> other = mindspore.tensor([1, 0, 3]) >>> mindspore.ops.bitwise_or(input, other) Tensor(shape=[3], dtype=Int64, value= [-1, -2, 3]) >>> # Same as calling via the | operator: >>> input | other Tensor(shape=[3], dtype=Int64, value= [-1, -2, 3]) >>> # When inputs are boolean: >>> input = mindspore.tensor([True, True, False]) >>> other = mindspore.tensor([False, True, False]) >>> mindspore.ops.bitwise_or(input, other) Tensor(shape=[3], dtype=Bool, value= [ True, True, False])