diff --git a/src/winml/modelkit/pattern/op_input_gen/op_input_gen.py b/src/winml/modelkit/pattern/op_input_gen/op_input_gen.py index 45b436370..cb5cb880d 100644 --- a/src/winml/modelkit/pattern/op_input_gen/op_input_gen.py +++ b/src/winml/modelkit/pattern/op_input_gen/op_input_gen.py @@ -1164,6 +1164,8 @@ def iter_qdq_combinations( needs_weight_iteration = False for input_name, is_constant in is_constant_map.items(): + if kwargs.get(input_name) is None: + continue # Optional input not provided — nothing to QDQ-wrap, skip if input_name not in qdq_config: # Input not in QDQ config - skip this combination # All inputs must be explicitly defined in qdq_config diff --git a/tests/unit/analyze/core/test_qdq.py b/tests/unit/analyze/core/test_qdq.py index 7253ca851..dd0ca0493 100644 --- a/tests/unit/analyze/core/test_qdq.py +++ b/tests/unit/analyze/core/test_qdq.py @@ -1106,8 +1106,9 @@ class TestIterQDQCombinations: ), # shape 3 * finite attributes 2 * 2 * 2 * optional combinations 2 * 2 * 2 * 4 ( "Pad", - 512, - ), # shape 8 * mode 4 * QDQ 4 * is_constant pads 2 * Tind 2 (actually axes not used) + 1024, + ), # shape 8 * mode 4 * QDQ 4 * is_constant pads 2 * constant_value present/absent 2 + # * Tind 2 (axes not used) # All Reduce* use this and it is enough ( "ReduceSum",