<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/modeling/optimization/ema_optimizer.py#L24-L48) |

Maybe invoke `fn` via `merge_call` which may or may not be fulfilled.

    tfm.optimization.ema_optimizer.maybe_merge_call(
        fn, strategy, *args, **kwargs
    )

The caller of this utility function requests to invoke `fn` via `merge_call`
at [`tf.distribute.Strategy`](https://www.tensorflow.org/api_docs/python/tf/distribute/Strategy)'s best efforts. It is [`tf.distribute`](https://www.tensorflow.org/api_docs/python/tf/distribute)'s internal
whether the request is honored, depending on the `Strategy`. See
[`tf.distribute.ReplicaContext.merge_call()`](https://www.tensorflow.org/api_docs/python/tf/distribute/ReplicaContext#merge_call) for more information.

This is adapted from tensorflow/python/distribute/merge_call_interim.py.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `fn` | the function to be invoked. |
| `strategy` | the [`tf.distribute.Strategy`](https://www.tensorflow.org/api_docs/python/tf/distribute/Strategy) to call `fn` with. |
| `*args` | the positional arguments to be passed in to `fn`. |
| `**kwargs` | the keyword arguments to be passed in to `fn`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The return value of the `fn` call. ||

<br />