feat: add model reshape support to high-level API #182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Description
This PR implements high-level, safe Rust bindings for the OpenVINO model reshape functionality. Currently, the
openvinocrate lacks a way to reshape models after they are loaded, which is a prerequisite for use cases involving dynamic batching or variable image resolutions.This contribution bridges the gap between the low-level
openvino-sysFFI and the ergonomicopenvinocrate by adding five core reshape methods to theModelstruct.Related Issue
Closes #181
Changes
crates/openvino/src/model.rs:reshape: Enables name-to-PartialShapemapping for multi-input models.reshape_single_input: An ergonomic helper for the common single-input model use case.reshape_input_by_name: Targets a specific input port by its name string.reshape_by_port_indexes: Enables index-based reshaping.reshape_by_ports: EnablesNode/Port-based reshaping.crates/openvino/src/partial_shape.rs:c_structtopub(crate). This allows themodelmodule to pass the underlyingov_partial_shape_tto FFI calls while keeping it hidden from the end-user.crates/openvino/src/node.rs:pub(crate) fn as_ptr()helper to expose the internalov_output_const_port_tpointer required forov_model_reshape_by_ports.crates/openvino/tests/reshape.rs:alexnetfixture to verify that all five reshape variants correctly communicate with the OpenVINO C++ runtime and that model state updates correctly (includingis_dynamicchecks).Testing and Compliance
cargo test -p openvino --test reshapecargo fmt --all