<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.15.0/keras/src/callbacks.py#L986-L1003) |

Callback that terminates training when a NaN loss is encountered.

Inherits From: [`Callback`](https://www.tensorflow.org/versions/r2.15/api_docs/python/tf/keras/callbacks/Callback.md.txt)

```python
tf.keras.callbacks.TerminateOnNaN()
```

## Methods

### `set_model`

[View source](https://github.com/keras-team/keras/tree/v2.15.0/keras/src/callbacks.py#L694-L695)

```python
set_model(
    model
)
```

### `set_params`

[View source](https://github.com/keras-team/keras/tree/v2.15.0/keras/src/callbacks.py#L691-L692)

```python
set_params(
    params
)
```