Quantization, TVM code generation and deployment are all fine. However, I cannot run the inference loop more than once for some reason.
The "template_project_for_model" calls tvmgen_default_run only once, so in my app_main.c, I've changed it so that its called in the while loop instead as below:
Code: Select all
static const char *TAG = "APP_MODEL";
static void inference_task()
{
struct tvmgen_default_inputs inputs = {
.input_1 = input_data,
};
struct tvmgen_default_outputs outputs = {
.output = output_data,
};
while (1)
{
uint64_t elapsed_time = 0;
uint64_t time1, time2;
time1 = esp_timer_get_time();
int ret_val = tvmgen_default_run(&inputs, &outputs);
time2 = esp_timer_get_time();
elapsed_time = time2 - time1;
printf("\ntime: %lld us\n", elapsed_time);
for (int i = 0; i < output_len; i++)
{
printf("%f, ", output_data[i]);
}
printf("\n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void app_main()
{
xTaskCreatePinnedToCore(inference_task, TAG, 8 * 1024, NULL, 6, NULL, 0);
}
What am I missing here.
Thanks and regards