mindspore.Tensor.bitwise_or

查看源文件
mindspore.Tensor.bitwise_or(other)

逐元素执行两个Tensor的或运算。

说明

参数 selfother 遵循隐式类型转换规则,使数据类型保持一致。

参数:
  • other (Tensor, Number.number) - 输入Tensor或常量,shape与 self 相同,或能与 self 的shape广播。

返回:

Tensor,与广播后的输入shape相同,和 self 数据类型相同。

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor
>>> input = Tensor(np.array([0, 0, 1, -1, 1, 1, 1]), mindspore.int16)
>>> other = Tensor(np.array([0, 1, 1, -1, -1, 2, 3]), mindspore.int16)
>>> output = input.bitwise_or(other)
>>> print(output)
[ 0  1  1 -1 -1  3  3]