As you’ve described, the issue is caused by a shape mismatch in the spatial dimension.
Did you trace or script the model before exporting it? The former case would not capture any data-dependent control flow and I would assume that YOLO would need it.