logical_and( x, y, out=None, name=None )
logical_andoperator computes element-wise logical AND on
y, and returns
outare N-dim boolean
Tensor. Each element of
outis calculated by\[out = x \&\& y\]
paddle.logical_andsupports broadcasting. If you want know more about broadcasting, please refer to Broadcasting.
x (Tensor) – the input tensor, it’s data type should be bool.
y (Tensor) – the input tensor, it’s data type should be bool.
out (Tensor) – The
Tensorthat specifies the output of the operator, which can be any
Tensorthat has been created in the program. The default value is None, and a new
Tensorwill be created to save the output.
name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
N-D Tensor. A location into which the result is stored. It’s dimension equals with
import paddle x = paddle.to_tensor([True]) y = paddle.to_tensor([True, False, True, False]) res = paddle.logical_and(x, y) print(res) # [True False True False]