# tff.learning.templates.reject_non_finite_update

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Rejects the update if any non-finite value is in the update.

    tff.learning.templates.reject_non_finite_update(
        state: Any, update: Any
    ) -> tuple[tf.Tensor, _MeasurementsType]

This is the default `should_reject_update` function used in
`build_apply_optimizer_finalizer`.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `state` | Unused optimzier state. |
| `update` | The update to be applied to the model's weights by the optimizer. |

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tuple of: <br /> - should_reject (bool tensor): True if the update should be rejected, False otherwise. - measurements (OrderedDict): A dict with a single key (`update_non_finite`) an an integer tensor of whether the update was rejected. ||

<br />