mars.tensor.logical_and

mars.tensor.logical_and(x1, x2, out=None, where=None, **kwargs)[source]

Compute the truth value of x1 AND x2 element-wise.

x1, x2 : array_like
Input tensors. x1 and x2 must be of the same shape.
out : Tensor, None, or tuple of Tensor and None, optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated tensor is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
where : array_like, optional
Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.

**kwargs

y : Tensor or bool
Boolean result with the same shape as x1 and x2 of the logical AND operation on corresponding elements of x1 and x2.

logical_or, logical_not, logical_xor bitwise_and

>>> import mars.tensor as mt
>>> mt.logical_and(True, False).execute()
False
>>> mt.logical_and([True, False], [False, False]).execute()
array([False, False])
>>> x = mt.arange(5)
>>> mt.logical_and(x>1, x<4).execute()
array([False, False,  True,  True, False])