[Parsing Error] IndexError in _handle_spatial_flatten_before_dynamic_weights_layer when parsing custom YOLO26 ONNX model with DFC 3.33.1

Hi Hailo community,

I’m trying to convert a custom YOLO26 model (modified architecture with additional attention/unfold modules) to HEF format for Hailo-8, but I keep hitting an IndexError during the parsing stage regardless of which end nodes I specify.

Environment:

Hailo DFC Version: 3.33.1
Hardware: Hailo-8
OS: Linux (Ubuntu), Kernel 5.15.0
What I did:

Trained a custom YOLO26 model in PyTorch and exported to ONNX.
Fixed double/float type mismatch in BatchNormalization nodes (e.g. /model.20/cv1/bn/BatchNormalization).
Attempted to parse with hailo parser onnx using various --end-node-names (from /model.15/Concat all the way back to /model.4/cv2/act/Mul).

Model characteristics:

Contains custom attention modules (/model.17/ and /model.21/) with unfold/pad_att operations, including Shape, Gather, Range, Unsqueeze, Transpose, Reshape ops.
Some Conv nodes have their weights provided via Constant nodes (e.g. /model.1/cv2/conv/Constant) rather than standard initializers.
The model also contains Cast ops in several layers (e.g. /model.20/cv1/conv/Cast).
What I’ve already tried:

Fixing double → float32 type mismatch in initializers.
Fixing topological sort issues in the ONNX graph.
Running onnxsim (fails due to dynamic shape ops in /model.17/ and /model.21/).
Specifying progressively earlier --end-node-names (down to /model.4/cv2/act/Mul) — same error every time.
Checking for non-4D Conv kernels and dynamic-weight Conv nodes — no issues found via script.
The error appears to be triggered by Conv nodes whose weights come from Constant nodes rather than standard ONNX initializers, but I’m not certain.

Could anyone advise on how to resolve this IndexError in the fuser stage? Is this a known limitation of DFC 3.33.1 with dynamic-weight convolutions, and is there a recommended workaround?

Thank you!
I am a complete beginner and this is my first time using Hailo. I have uploaded the ONNX model file to the following Google Drive link — thank you very much for your help!

:paperclip: ONNX file: https://drive.google.com/file/d/1KgdHGS4hyzCvLVsFt0MyAdtVKQw7Nomy/view?usp=drive_link

Hi @user1066,

The IndexError in _handle_spatial_flatten_before_dynamic_weights_layer seems to be a known category of parsing issues in DFC 3.33.1 where the ONNX translator encounters Conv nodes whose weights are provided via Constant nodes rather than standard graph initializers - Please see Dataflow compiler (3.28.0) fails to parse fine-tuned yolov10n ONNX model and Parsing custom ONNX - YoloV7 for related cases.

Since the error persists even with very early --end-node-names, the issue likely comes from your backbone layers. You might try re-exporting from PyTorch with do_constant_folding=True to fold Constant nodes into proper initializers, and possibly use a lower opset (13 or 15 have worked better for some users). Your custom attention/unfold modules in /model.17/ and /model.21/ with dynamic shape ops (Shape, Gather, Range) are generally not supported by the Hailo parser - you might need to restructure them to use static shapes, or exclude them via --end-node-names and handle them on the host CPU instead.

Thanks,
Michael