<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) |

Keras-based transformer block layer.

## Classes

[`class TfFunctionIfEagerDecorator`](https://www.tensorflow.org/api_docs/python/tfm/nlp/layers/util/TfFunctionIfEagerDecorator): Helper decorator function to optionally apply the @tf.function annotation.

## Functions

[`filter_kwargs(...)`](https://www.tensorflow.org/api_docs/python/tfm/nlp/layers/util/filter_kwargs): In place removes unused options in kwargs.

[`tf_function_if_eager(...)`](https://www.tensorflow.org/api_docs/python/tfm/nlp/layers/util/tf_function_if_eager): Applies the @tf.function decorator only if running in eager mode.