[Python API] Added implicit input reshaping API and extended `reshape()` Unit Tests.
Changes
-
New Overload: Adds a new overload to [Model.reshape] that accepts a list of shapes (e.g., [model.reshape([[2,2], [1,3,224,244], [10]]). Each shape in the list is assigned to the corresponding input in order.
-
Simplified API: This enables a more concise and intuitive way to reshape all model inputs, improving usability for common scenarios.
-
Tests: Adds unit tests to ensure the new API works as expected, including error handling for mismatched input counts.
Description
This PR also expands the Python API unit test suite for Model.reshape() to cover additional usage patterns, edge cases, and validation scenarios. It builds on the existing reshape tests by:
- Adding named input, port mapping, and
PartialShapewith tensor name coverage. - Testing layout-sensitive reshapes.
- Verifying propagation of reshaped dimensions to all outputs.
- Confirming reshape works on subgraphs constructed in-memory.
- Ensuring invalid shapes trigger compile-time errors when appropriate.
- Strengthening interval dimension tests to validate min/max bounds, dynamic status, and correct acceptance/rejection behaviour.
All new tests follow the same upstream style:
- In-memory model construction (no external IR files).
- Minimal, deterministic setups.
- Clear, direct assertions.
- Compile step where needed to enforce runtime validation.
Testing
All new tests pass locally against the latest OpenVINO build.
A clean version of: #31871
Closes: #18347
@p-wysocki @jiwaszki @akuporos
. @p-wysocki @jiwaszki @akuporos
PS: I can see python api linter checks failed. Please fix them