Generating C-byte arrays for input, output, and labels
The C code produced by TVM does not include the input and output tensors because they need to be allocated explicitly by the user.
In this recipe, we will develop a Python script to generate three C-byte arrays containing the input and output tensors and labels required to report the classification result in the application. The input tensor will also be filled with a valid image to test the inference on a microNPU.
The following Python script contains the code referred to in this recipe:
prepare_assets.py
:
Getting ready
To get ready with this recipe, we need to know how to structure the Python script for the C-byte array generation.
The Python script should produce a C header file for each C-byte array. The generated files must be saved in the ~/project_npu/src/include
folder and named as follows...