mindspore.ops.BitwiseOr

class mindspore.ops.BitwiseOr[源代码]

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

更多细节详见 mindspore.ops.bitwise_or()

输入:
  • x (Tensor) - 第一个输入Tensor,其shape为 \((N, *)\) ,其中 \(*\) 为任意数量的额外维度。

  • y (Tensor) - 第二个输入Tensor,数据类型与 x 一致。

输出:

Tensor,是一个与 x 相同类型的Tensor。

支持平台:

Ascend GPU CPU

样例:

>>> x = Tensor(np.array([0, 0, 1, -1, 1, 1, 1]), mindspore.int16)
>>> y = Tensor(np.array([0, 1, 1, -1, -1, 2, 3]), mindspore.int16)
>>> bitwise_or = ops.BitwiseOr()
>>> output = bitwise_or(x, y)
>>> print(output)
[ 0  1  1 -1 -1  3  3]