OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[PyOV] Add default names to add_outputs method (#30849)
Anastasia Kuporosova499428a4078d
diff --git a/src/bindings/python/src/pyopenvino/graph/model.cpp b/src/bindings/python/src/pyopenvino/graph/model.cppindex bd28d5272f3..b8431c0e290 100644--- a/src/bindings/python/src/pyopenvino/graph/model.cpp+++ b/src/bindings/python/src/pyopenvino/graph/model.cpp@@ -1070,6 +1070,8 @@ void regclass_graph_Model(py::module m) {new_outputs.emplace_back(out);i++;}+ // Try to remove when it will be covered in C++ API+ ov::util::set_tensors_names(ov::AUTO, self);return new_outputs;},py::arg("outputs"));diff --git a/src/bindings/python/tests/test_runtime/test_model.py b/src/bindings/python/tests/test_runtime/test_model.pyindex 44bcc722941..aecefa0cd7c 100644--- a/src/bindings/python/tests/test_runtime/test_model.py+++ b/src/bindings/python/tests/test_runtime/test_model.py@@ -93,13 +93,13 @@ def test_add_output_port():input_shape = PartialShape([1])param = ops.parameter(input_shape, dtype=np.float32, name="data")relu1 = ops.relu(param, name="relu1")- relu1.get_output_tensor(0).set_names({"relu_t1"})relu2 = ops.relu(relu1, name="relu2")model = Model(relu2, [param], "TestModel")assert len(model.results) == 1new_outs = model.add_outputs(relu1.output(0))assert len(model.results) == 2assert len(new_outs) == 1+ assert len(new_outs[0].names) != 0assert new_outs[0].get_node().get_instance_id() == model.outputs[1].get_node().get_instance_id()assert new_outs[0].get_index() == model.outputs[1].get_index()