<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L8574-L8594) |

Return elements chosen from `x1` or `x2` depending on `condition`.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.where`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/where)

<br />

    tf.keras.ops.where(
        condition, x1=None, x2=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `condition` | Where `True`, yield `x1`, otherwise yield `x2`. |
| `x1` | Values from which to choose when `condition` is `True`. |
| `x2` | Values from which to choose when `condition` is `False`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor with elements from `x1` where `condition` is `True`, and elements from `x2` where `condition` is `False`. ||

<br />