ESP32-S3 TVM Example crash after 1st inference
Posted: Sun Jan 28, 2024 8:07 am
I'm trying to run the sample model.onnx provided in esp-who/components/esp-dl/tutorial/tvm_example/model.onnx using esp-who/components/esp-dl/tutorial/tvm_example/script.sh
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:
However, after the 1st iteration of the while loop, the 2nd call to the tvmgen_default_run never finishes and I believe the application crashes.
What am I missing here.
Thanks and regards
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