<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/core.py#L1118-L1130) |

Conditionally applies `true_fn` or `false_fn`.

    tf.keras.ops.cond(
        pred, true_fn, false_fn
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `pred` | Boolean scalar type |
| `true_fn` | Callable returning the output for the `pred == True` case. |
| `false_fn` | Callable returning the output for the `pred == False` case. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The output of either `true_fn` or `false_fn` depending on pred. ||

<br />