mindspore.ops.logical_or
- mindspore.ops.logical_or(x, y)[源代码]
Computes the “logical OR” of two tensors element-wise.
Inputs of x and y comply with the implicit type conversion rules to make the data types consistent. The inputs must be two tensors or one tensor and one bool. When the inputs are two tensors, the shapes of them could be broadcast, and the data types of them must be bool. When the inputs are one tensor and one bool, the bool object could only be a constant, and the data type of the tensor must be bool.
\[out_{i} = x_{i} \vee y_{i}\]Note
LogicalOr supports broadcasting.
- Parameters
- Returns
Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
- Raises
TypeError – If neither x nor y is a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([True, False, True]), mindspore.bool_) >>> y = Tensor(np.array([True, True, False]), mindspore.bool_) >>> output = ops.logical_or(x, y) >>> print(output) [ True True True]