Hi @Isaac_Nunez ,
Maybe the following might assist:
- Use pre‑quantization optimizations for problematic avgpools
For avgpool layers that cause quantization/encoding issues (especially global or near‑global pools), the recommended approach is to transform them before quantization, e.g.:
pre_quantization_optimization(global_avgpool_reduction, layers=avgpool1, division_factors=[4, 4])
This reduces the spatial dimensions before the final global pool and can make the layer more quantization‑friendly. See: Average Pool error cannot quantize and An error occurred when compiling the custom model into a HEF file
If your failing layers are global or large‑kernel avgpools, applying such a pre‑quantization optimization before train_encoding may avoid the internal inconsistency that leads to the tensor/non‑tensor mix error.
- Confirm
layers_to_freezeusage
The docs define layers_to_freeze as:
Freeze (don’t modify weights&biases for) any layer whose name includes one of this list as a substring.
See: https://hailo.ai/developer-zone/documentation/dataflow-compiler-v3-33-0/?sp_referrer=sdk%2Fmodel_optimization.html#train-encoding and https://hailo.ai/developer-zone/documentation/dataflow-compiler-v5-2-0/?sp_referrer=sdk%2Fmodel_optimization.html#finetune
That means:
-
You must pass substrings that actually appear in the Hailo‑HN layer names (e.g.
avgpool1,avgpool), not framework‑side names. -
Freezing a layer only prevents its weights/biases from being updated; it doesn’t change how its tensors are represented in the graph. So if the error is about mixing tensor/non‑tensor objects in the computation graph, freezing alone may not resolve it.
Please let me know if that was helpful.
Thanks,