Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Util to set (auto) names on model's input, output tensors #28975

Conversation

praasz
Copy link
Contributor

@praasz praasz commented Feb 13, 2025

Details:

  • Add utils to core to set names on model input/output tensors
  • Define default tensor names and port separator
  • Use auto naming in model created by python API. Model outputs will have got names also.
  • The auto naming can be part of Model API but requires to add validation tools to find and resolve names collision
  • Auto naming cannot be added to Model creation in C++ as it can have impact on (de)serialization, requires more investigation

Tickets:

Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
@praasz praasz requested review from a team as code owners February 13, 2025 13:09
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: Python API OpenVINO Python bindings category: CPP API OpenVINO CPP API bindings labels Feb 13, 2025
Copy link
Contributor

@olpipi olpipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general

@praasz praasz requested a review from olpipi February 19, 2025 05:53
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
@praasz praasz requested a review from t-jankowski February 19, 2025 12:11
Signed-off-by: Raasz, Pawel <pawel.raasz@intel.com>
template <class... Args>
std::shared_ptr<ov::Model> make_model_with_tensor_names(Args&&... args) {
auto model = std::make_shared<ov::Model>(std::forward<Args>(args)...);
ov::util::set_tensors_names(ov::AUTO, *model);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that each output node will have a name?
I am asking in the context of the issue in js api, when output.get_any_name() fails.
Or here are also problems with resolving names collisions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is added only for python API, only model input and outputs will have tensor names when created with python API.
Similar approach can be used in other binding, but there is plan to add in C++ API, but now is not possible yet

@praasz praasz requested a review from almilosz February 20, 2025 11:20
@mlukasze mlukasze added this pull request to the merge queue Feb 20, 2025
Merged via the queue into openvinotoolkit:master with commit 015fe97 Feb 20, 2025
188 checks passed
@praasz praasz added this to the 2025.1 milestone Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: Python API OpenVINO Python bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants