MVP Python Wrapper

This allows for running the MVP-accelerated Tensorflow-Lite Micro (TFLM) kernels from a Python script.

This is useful as it allows for running .tflite model files in the MVP simulator and determining values such as:

  • Required runtime memory (i.e. RAM)

  • Number of MVP clock cycles required to execute model

  • Which parts the model were not able to be accelerated

This wrapper is not used directly. Instead, it is loaded by the TfliteMicro Python package when specifying the accelerator = mvp.

Source Code

Building the Wrapper

Pre-built

This wrapper comes pre-built when installing the MLTK Python package, e.g.:

pip install silabs-mltk

Automatic Build

This wrapper is automatically built when installing from source, e.g.:

git clone https://github.com/siliconlabs/mltk.git
cd mltk
pip install -e .

Manual build via MLTK command

To manually build this wrapper, issue the MLTK command:

mltk build mvp_wrapper

Manual build via CMake

This wrapper can also be built via CMake using Visual Studio Code or the Command Line.

To build the wrapper, the build_options.cmake file needs to be modified.

Create the file <mltk repo root>/user_options.cmake and add:

mltk_set(MLTK_TARGET mltk_mvp_wrapper)

Note

You must remove this option and clean the build directory before building the example applications

Then configure the CMake project using the Window/Linux GCC toolchain and build the target: mltk_mvp_wrapper.