Skip to content

Conversation

@Jarvis2001
Copy link

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 PartialShape with 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

@Jarvis2001 Jarvis2001 requested a review from a team as a code owner November 2, 2025 17:29
@github-actions github-actions bot added the category: Python API OpenVINO Python bindings label Nov 2, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Python API OpenVINO Python bindings ExternalPR External contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend Python API with a new model.reshape() overload

2 participants