logical_or¶
- paddle. logical_or ( x, y, out=None, name=None ) [source]
-
logical_oroperator computes element-wise logical OR onxandy, and returnsout.outis N-dim booleanTensor. Each element ofoutis calculated by\[out = x || y\]Note
paddle.logical_orsupports broadcasting. If you want know more about broadcasting, please refer to Broadcasting.- Parameters
-
x (Tensor) – the input tensor, it’s data type should be one of bool, int8, int16, in32, in64, float32, float64.
y (Tensor) – the input tensor, it’s data type should be one of bool, int8, int16, in32, in64, float32, float64.
out (Tensor) – The
Variablethat specifies the output of the operator, which can be anyTensorthat has been created in the program. The default value is None, and a newTensorwill be created to save the output.name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
N-D Tensor. A location into which the result is stored. It’s dimension equals with
x.
Examples
import paddle import numpy as np x_data = np.array([True, False], dtype=np.bool).reshape(2, 1) y_data = np.array([True, False, True, False], dtype=np.bool).reshape(2, 2) x = paddle.to_tensor(x_data) y = paddle.to_tensor(y_data) res = paddle.logical_or(x, y) print(res) # [[ True True] [ True False]]
