-
Notifications
You must be signed in to change notification settings - Fork 216
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
add support for model outputs without names #2850
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0c8fc87
add supprt for model outputs without names
dtrawins d62b6d9
style
dtrawins 69c201c
style
dtrawins ceaf202
style
dtrawins 90f5ca8
test dummy model
dtrawins 5fed196
fix
dtrawins 19c8928
unit tests for no_name model
dtrawins aea68a9
fix unit tests and merge
dtrawins 5a84efa
style
dtrawins 5b9a3df
Merge branch 'main' into no-ouput-name
dtrawins 2dae97c
review changes
173efc8
Merge branch 'main' into no-ouput-name
dtrawins 698c871
fix
4f02072
fix
028a2e4
header
c3bb028
review changes
dtrawins 8a4646d
Merge remote-tracking branch 'origin/main' into no-ouput-name
dtrawins c561e49
fix
dtrawins 8e4b00b
rereview changes
dtrawins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0"?> | ||
<net name="no_name_output" version="11"> | ||
<layers> | ||
<layer id="1" name="input_1" type="Parameter" version="opset1"> | ||
<data shape="1,10" element_type="i8" /> | ||
<output> | ||
<port id="0" precision="I8" names="input_1"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</output> | ||
</layer> | ||
<layer id="0" name="input_2" type="Parameter" version="opset1"> | ||
<data shape="1,10" element_type="i8" /> | ||
<output> | ||
<port id="0" precision="I8" names="input_2"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</output> | ||
</layer> | ||
<layer id="2" name="ADD" type="Add" version="opset1"> | ||
<data auto_broadcast="numpy" /> | ||
<input> | ||
<port id="0" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
<port id="1" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</input> | ||
<output> | ||
<port id="2" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</output> | ||
</layer> | ||
<layer id="4" name="MULTIPLY" type="Multiply" version="opset1"> | ||
<data auto_broadcast="numpy" /> | ||
<input> | ||
<port id="0" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
<port id="1" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</input> | ||
<output> | ||
<port id="2" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</output> | ||
</layer> | ||
<layer id="5" name="Result_5" type="Result" version="opset1"> | ||
<input> | ||
<port id="0" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</input> | ||
</layer> | ||
<layer id="3" name="Result_6" type="Result" version="opset1"> | ||
<input> | ||
<port id="0" precision="I8"> | ||
<dim>1</dim> | ||
<dim>10</dim> | ||
</port> | ||
</input> | ||
</layer> | ||
</layers> | ||
<edges> | ||
<edge from-layer="0" from-port="0" to-layer="2" to-port="0" /> | ||
<edge from-layer="0" from-port="0" to-layer="4" to-port="0" /> | ||
<edge from-layer="1" from-port="0" to-layer="2" to-port="1" /> | ||
<edge from-layer="1" from-port="0" to-layer="4" to-port="1" /> | ||
<edge from-layer="2" from-port="2" to-layer="3" to-port="0" /> | ||
<edge from-layer="4" from-port="2" to-layer="5" to-port="0" /> | ||
</edges> | ||
<rt_info /> | ||
</net> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# | ||
# Copyright (c) 2025 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import openvino.runtime as ov | ||
import numpy as np | ||
import os | ||
|
||
batch_dim = [] | ||
shape = [1, 10] | ||
dtype = np.int8 | ||
model_name = "no_name_output" | ||
model_version_dir = model_name | ||
print(batch_dim + shape) | ||
in0 = ov.opset1.parameter(shape=batch_dim + shape, dtype=dtype, name="input_1") | ||
in1 = ov.opset1.parameter(shape=batch_dim + shape, dtype=dtype, name="input_2") | ||
op0 = ov.opset1.multiply(in1, in0, name="MULTIPLY") | ||
op1 = ov.opset1.add(in1, in0, name="ADD") | ||
|
||
model = ov.Model([op0, op1], [in0, in1], model_name) | ||
|
||
for idx, inp in enumerate(model.inputs): | ||
print(f"Input {idx}: {inp.get_names()} {inp.get_shape()} {inp.get_index()}") | ||
print(model.outputs) | ||
for idx, out in enumerate(model.outputs): | ||
print(f"Output {idx}: {out.get_names()} {out.get_shape()} {out.get_index()} ") | ||
assert len(out.get_names()) == 0, "number of output names should be 0" | ||
|
||
try: | ||
os.makedirs(model_version_dir) | ||
except OSError as ex: | ||
pass # ignore existing dir | ||
|
||
ov.serialize(model, model_version_dir + "/model.xml", model_version_dir + "/model.bin") | ||
|
||
ov_model = ov.Core().read_model(model_version_dir + "/model.xml") | ||
compiled_model = ov.Core().compile_model(model, "CPU") | ||
|
||
input_data = np.ones((1, 10),dtype=np.int8)*10 | ||
results = compiled_model({"input_1": input_data, "input_2": input_data}) | ||
assert np.all(results[0] == 100), "for inputs np.ones((1, 10), the expected output is 100 in every element: 10*10" | ||
assert np.all(results[1] == 20), "for inputs np.ones((1, 10), the expected output is 20 in every element: 10+10" | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this script meant to be used only manually by developers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a reference how the test model got created in case some changes should be applied.