<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/layers/util.py#L44-L46) |

Applies the @tf.function decorator only if running in eager mode.

    tfm.nlp.layers.util.tf_function_if_eager(
        **kwargs
    )