[ONNX] Enhance tensor handling for external data and add tests for ex…#34973
Merged
sgbihu merged 4 commits intoopenvinotoolkit:masterfrom Apr 4, 2026
Merged
Conversation
29941f6 to
f5260f0
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ONNX frontend’s initializer/tensor handling for external data (including ORT-managed memory cases) and adds a regression test to cover the “0-size external weight / empty shape” scenario referenced by CVS-183409.
Changes:
- Treat
TensorONNXPlaceinstances withdata_locationas externally backed when computing element counts. - In ORT “self-managed data” (
*/_ORT_MEM_ADDR_/*) case, propagate an external location string so the tensor is handled via the external-data path. - Add a new Expand scalar regression test and corresponding model.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontends/onnx/tests/onnx_import.in.cpp | Adds a new regression test for Expand scalar with ORT-managed empty external shape tensor. |
| src/frontends/onnx/tests/models/expand_scalar_failsafe_node_ort_mem.prototxt | Adds a model with an external initializer using the ORT memory marker and zero length. |
| src/frontends/onnx/frontend/src/core/tensor.hpp | Adjusts element-count computation for TensorONNXPlace when data_location is present. |
| src/frontends/onnx/frontend/src/core/tensor.cpp | Refactors external buffer handling and adds size/shape consistency validation for constants. |
| src/frontends/onnx/frontend/src/core/graph_iterator_proto.cpp | Ensures ORT-managed external data carries an external_location marker. |
df4822a to
f99a3b7
Compare
Contributor
Author
|
build_jenkins |
mvafin
approved these changes
Apr 2, 2026
Merged
via the queue into
openvinotoolkit:master
with commit Apr 4, 2026
134e40c
220 of 222 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Details:
Tickets:
AI Assistance: