# Export functions

## Export functions

### Main functions

**optimum.exporters.tflite.export**

[\<source>](https://github.com/huggingface/optimum/blob/main/optimum/exporters/tflite/convert.py#L313)

( model: TFPreTrainedModelconfig: TFLiteConfigoutput: Pathtask: typing.Optional\[str] = Nonepreprocessor: typing.Union\[transformers.tokenization\_utils\_base.PreTrainedTokenizerBase, transformers.image\_processing\_utils.BaseImageProcessor, NoneType] = Nonequantization\_config: typing.Optional\[ForwardRef('TFLiteQuantizationConfig')] = None ) → `Tuple[List[str], List[str]]`

Parameters

* **model** (`TFPreTrainedModel`) — The model to export.
* **config** ([TFLiteConfig](https://huggingface.co/docs/optimum/main/en/exporters/tflite/package_reference/configuration#optimum.exporters.tflite.TFLiteConfig)) — The TFLite configuration associated with the exported model.
* **output** (`Path`) — Directory to store the exported TFLite model.
* **task** (`Optional[str]`, defaults to `None`) — The task of the model. If left unspecified the task will be inferred automatically. Only needed for static quantization.
* **preprocessor** (`Optional[Preprocessor]`, defaults to `None`) — The preprocessor associated to the model. This is used for preprocessing the dataset before feeding data to the model during calibration.
* **quantization\_config** (`Optional[TFLiteQuantizationConfig]`, defaults to `None`) — The dataclass containing all the needed information to perform quantization.

Returns

`Tuple[List[str], List[str]]`

A tuple with an ordered list of the model’s inputs, and the named inputs from the TFLite configuration.

Exports a TensorFlow model to a TensorFlow Lite model.

### Utility functions

**optimum.exporters.tflite.validate\_model\_outputs**

[\<source>](https://github.com/huggingface/optimum/blob/main/optimum/exporters/tflite/convert.py#L43)

( config: TFLiteConfigreference\_model: TFPreTrainedModeltflite\_model\_path: Pathtflite\_named\_outputs: typing.List\[str]atol: typing.Optional\[float] = None )

Parameters

* **config** ([TFLiteConfig](https://huggingface.co/docs/optimum/main/en/exporters/tflite/package_reference/configuration#optimum.exporters.tflite.TFLiteConfig) — The configuration used to export the model.
* **reference\_model** (`~TFPreTrainedModel`) — The model used for the export.
* **tflite\_model\_path** (`Path`) — The path to the exported model.
* **tflite\_named\_outputs** (`List[str]`) — The names of the outputs to check.
* **atol** (`Optional[float]`, defaults to `None`) — The absolute tolerance in terms of outputs difference between the reference and the exported model.

Raises

`ValueError`

* `ValueError` — If the outputs shapes or values do not match between the reference and the exported model.

Validates the export by checking that the outputs from both the reference and the exported model match.
