# tf.math.logical_and

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/math/logical_and) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.2.0/tensorflow/python/ops/math_ops.py#L1360-L1399) |

Logical AND function.

#### View aliases


**Main aliases**

[`tf.logical_and`](https://www.tensorflow.org/api_docs/python/tf/math/logical_and)
**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.logical_and`](https://www.tensorflow.org/api_docs/python/tf/math/logical_and), [`tf.compat.v1.math.logical_and`](https://www.tensorflow.org/api_docs/python/tf/math/logical_and)

<br />

    tf.math.logical_and(
        x, y, name=None
    )

The operation works for the following input types:

- Two single elements of type `bool`
- One [`tf.Tensor`](https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/Tensor) of type `bool` and one single `bool`, where the result will be calculated by applying logical AND with the single element to each element in the larger Tensor.
- Two [`tf.Tensor`](https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/Tensor) objects of type `bool` of the same shape. In this case, the result will be the element-wise logical AND of the two input tensors.

#### Usage:

    a = tf.constant([True])
    b = tf.constant([False])
    tf.math.logical_and(a, b)
    <tf.Tensor: shape=(1,), dtype=bool, numpy=array([False])>

    c = tf.constant([True])
    x = tf.constant([False, True, True, False])
    tf.math.logical_and(c, x)
    <tf.Tensor: shape=(4,), dtype=bool, numpy=array([False,  True,  True, False])>

    y = tf.constant([False, False, True, True])
    z = tf.constant([False, True, False, True])
    tf.math.logical_and(y, z)
    <tf.Tensor: shape=(4,), dtype=bool, numpy=array([False, False, False,  True])>

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/Tensor) type bool. |
| `y` | A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/Tensor) of type bool. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.Tensor`](https://www.tensorflow.org/versions/r2.2/api_docs/python/tf/Tensor) of type bool with the same size as that of x or y. ||

<br />