openvino
c373dcf7 - Fix: Defer axis validation in reduce operations to compile/runtime (#33450)

Commit
29 days ago
Fix: Defer axis validation in reduce operations to compile/runtime (#33450) ## Summary This PR addresses issue #33261 by deferring axis validation for reduce operations from node creation time to compile/runtime, improving the user experience when building models with the Python opset API. ## Problem Previously, when creating reduce operations (ReduceMean, ReduceMax, ReduceMin, etc.) with out-of-range axes via the Python opset API, validation would fail immediately during node construction with a `RuntimeError`. This was surprising behavior since users typically expect validation to occur at `core.compile_model()` time, not during model building. **Before (problematic behavior):** ```python import openvino.opset1 as ops x = ops.parameter([2], name="x") # 1D tensor y = ops.reduce_mean(x, axes=[1]) # axis 1 is out of range for rank 1 # RuntimeError: Axis 1 out of the tensor rank range [-1, 0] **After (improved behavior):** import openvino.opset1 as ops x = ops.parameter([2], name="x") # 1D tensor y = ops.reduce_mean(x, axes=[1]) # Node created successfully with dynamic output shape model = core.compile_model(model, "CPU") # Validation happens here with clear error message Fixes #33261 --------- Co-authored-by: Pawel Raasz <pawel.raasz@intel.com> Co-authored-by: Pavel Durandin <pavel.durandin@intel.com>
Author
Parents
Loading