<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/serving/serving_modules.py#L264-L335) |

The export module for the question answering task.

Inherits From: [`ExportModule`](https://www.tensorflow.org/api_docs/python/tfm/core/export_base/ExportModule)

    tfm.nlp.serving_modules.QuestionAnswering(
        params, model: tf_keras.Model, inference_step=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `params` | A dataclass for parameters to the module. |
| `model` | A model instance which contains weights and forward computation. |
| `inference_step` | An optional callable to forward-pass the model. If not specified, it creates a parital function with `model` as an required kwarg. |
| `preprocessor` | An optional callable to preprocess the inputs. |
| `postprocessor` | An optional callable to postprocess the model outputs. |

<br />

## Child Classes

[`class Params`](https://www.tensorflow.org/api_docs/python/tfm/nlp/serving_modules/QuestionAnswering/Params)

## Methods

### `get_inference_signatures`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/serving/serving_modules.py#L316-L335)

    get_inference_signatures(
        function_keys: Dict[Text, Text]
    )

Get defined function signatures.

### `serve`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/serving/serving_modules.py#L281-L296)

    @tf.function
    serve(
        input_word_ids, input_mask=None, input_type_ids=None
    ) -> Dict[str, tf.Tensor]

### `serve_examples`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/serving/serving_modules.py#L298-L314)

    @tf.function
    serve_examples(
        inputs
    ) -> Dict[str, tf.Tensor]