ONNX Runtime warns about output shape mismatch during inference — how to resolve it
2025-11-05 15:08:15.864946590 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {800,10} does not match actual shape of {512,10} for output 500
2025-11-05 15:08:15.865650383 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {800,4} does not match actual shape of {512,4} for output 497
2025-11-05 15:08:15.865954018 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {800,1} does not match actual shape of {512,1} for output 494
2025-11-05 15:08:15.869282742 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {3200,10} does not match actual shape of {2048,10} for output 477
2025-11-05 15:08:15.869774967 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {3200,4} does not match actual shape of {2048,4} for output 474
2025-11-05 15:08:15.870143491 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {3200,1} does not match actual shape of {2048,1} for output 471
2025-11-05 15:08:15.873704650 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {12800,10} does not match actual shape of {8192,10} for output 454
2025-11-05 15:08:15.874628621 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {12800,4} does not match actual shape of {8192,4} for output 451
2025-11-05 15:08:15.875117731 [W:onnxruntime:, execution_frame.cc:858 VerifyOutputSizes] Expected shape from model of {12800,1} does not match actual shape of {8192,1} for output 448
I encountered this warning while running inference. Will this affect the results?
This warning is likely caused by not specifying dynamic_axes when exporting the model to ONNX format. Consequently, the model treats the dimensions used during export as fixed (static) shapes. When an input with a different resolution is provided during inference, ONNX Runtime triggers this warning to indicate the mismatch. In most cases, this does not affect the actual inference results or accuracy. To eliminate this warning, you need to identify which specific model is causing the issue and re-export it with the correct dynamic shape configurations (e.g., setting dynamic_axes for input and output tensors in PyTorch).