2024-04-08 01:11 AM
The error occurs when I try to run the code generated for model squeezenetv1.1_xxx_tfs_int8.tflite
The command I used to generate code is stm32ai generate -m squeezenetv1.1_128_tfs_int8.tflite -O ram
And I follow the guide "How to run locally a c-model" in the X-CUBE-AI Documentation to get the executable.
When I run the elf, it returns an assertion failed which like this.
Assertion failed: (((ai_size)(ai_array_get_byte_size(((ai_array_format)(((ai_array*)(p_tensor_scratch->data))->format)), (((ai_array*)(p_tensor_scratch->data))->size)))) == scratch_size), function ai_layer_check_scratch_size, file layers.c, line 289.
To figure it out, I observe the intermediate output per layer following the guide "Platform Observer API" in the X-CUBE-AI Documentation.
And I find out that stm32ai generates the wrong size for the scratch data of one Conv2D layer.
The correct shape should be (1, 63, 63, 64), but the generated scratch size is (1, 3, 63, 64).
Since the stm32ai is a blackbox, I cannot move on to find the real problem.
b.t.w. My device is mac m1, and I first find this problem when I run the command stm32ai validate -m squeezenetv1.1_128_tfs_int8.tflite -O ram.
Solved! Go to Solution.
2024-04-09 08:11 AM
Hi ManuZhu,
Thanks for this feedback. I suppose that you use the 8.1 version of X-CUBE-AI. I have reproduced an issue with the "-O ram" and this model. I have not observed the assertion, however generated code seems effectively not correct. With X-CUBE-AI 9.0, validation is now OK with the "squeezenetv1.1_128_tfs_int8.tflite" model and -O ram option.
However,
Br,
Jean-Michel
2024-04-09 08:11 AM
Hi ManuZhu,
Thanks for this feedback. I suppose that you use the 8.1 version of X-CUBE-AI. I have reproduced an issue with the "-O ram" and this model. I have not observed the assertion, however generated code seems effectively not correct. With X-CUBE-AI 9.0, validation is now OK with the "squeezenetv1.1_128_tfs_int8.tflite" model and -O ram option.
However,
Br,
Jean-Michel
2024-04-10 07:26 PM
Hi Jean-Michel