TFLM is designed to run on microcontrollers and other platforms without dynamic memory allocation and without filesystems. This means that data files such as TFLite models and test inputs must be built into the binary.

Historically, data files have been included as cc arrays generated manually using xxd -i <data file> >

Data Files in Examples

In order to clean up examples, make test inputs easier to understand, and include TFLite models directly, TFLM has moved to generating the cc and header files during the build process using a python script which make and bazel call. To include data files in an example, generator inputs should be supplied to the microlite_test call in the example's Makefile and generate_cc_arrays should be used to create cc and header sources in the BUILD file.

For reference, see the Makefile and BUILD files in the hello_world example.

The generated cc and header files can be found in gen/<target>/genfiles/<path to example>.