Alignment of OV and ONNX models outputs naming (#7691)

* Alignment of OV and ONNX models outputs naming

* Python tests adaptation to new naming rules

* New output naming rules

* Output name retrieval adaptation (tensor iterator node)

* Copying of tensor names during output replacement

* Multiout multinode subgraphs handling in the importer

* Proper replacement tensor naming

* Model zoo test runner adaptation

* Backwards compatible python tests runner adaptation

* If node adaptation

* Adaptation to changes in master

* Deprecation warning suppression

* Imports fix in compatibility tests

* If node adaptation to the new naming

* MaxPool python tests re-enabled

* ONNX Identity elimination adaptation

* XFAIL for the Identity op test

* Support for Param->Result models and indentity op

* Fix of the ONNX Indentity handling

* The test that fails only on windows temporarily disabled

* ONNX tensor names test adaptation

* Code cleanup

* Code formatting

* Obsolete helper removal

* One more spot where output name helper should be used

* PyApi fix for tensors with multiple names

* Don't set friendly names for unnamed ONNX nodes

* Revert "Don't set friendly names for unnamed ONNX nodes"

This reverts commit 92c7ac59b5.

* Missing dot...

* And now the mypy nonsense...

* Use get_any_name in Loop

* New way of naming result nodes in ONNX FE
This commit is contained in:
Tomasz Dołbniak
2021-12-09 09:16:50 +01:00
committed by GitHub
parent 0f1c545a19
commit f9949b4140
23 changed files with 170 additions and 144 deletions

View File

@@ -6,6 +6,7 @@
#include <pybind11/numpy.h>
#include "ngraph/op/result.hpp"
#include "ngraph/validation_util.hpp"
#include "ngraph/version.hpp"

View File

@@ -10,6 +10,7 @@ from openvino.pyopenvino import Core as CoreBase
from openvino.pyopenvino import ExecutableNetwork as ExecutableNetworkBase
from openvino.pyopenvino import InferRequest as InferRequestBase
from openvino.pyopenvino import AsyncInferQueue as AsyncInferQueueBase
from openvino.pyopenvino import Output
from openvino.pyopenvino import Tensor
from openvino.pyopenvino import Variant as VariantBase
@@ -42,8 +43,15 @@ def normalize_inputs(py_dict: dict, py_types: dict) -> dict:
def get_input_types(obj: Union[InferRequestBase, ExecutableNetworkBase]) -> dict:
"""Get all precisions from object inputs."""
return {i.get_any_name(): i.get_element_type() for i in obj.inputs}
"""Map all tensor names of all inputs to the data types of those tensors."""
def map_tensor_names_to_types(input: Output) -> dict:
return {n: input.get_element_type() for n in input.get_names()}
input_types: dict = {}
for input in obj.inputs:
input_types = {**input_types, **map_tensor_names_to_types(input)}
return input_types
class InferRequest(InferRequestBase):

View File

@@ -142,7 +142,7 @@ def create_test_onnx_models():
make_tensor_value_info("out4", onnx.TensorProto.FLOAT, (2, 2)),
]
expected_split = onnx.helper.make_node("Split", inputs=["out1/placeholder_port_0"],
outputs=["out1", "out2"])
outputs=["out1", "out2"], name="split1", axis=0)
expected_mul = onnx.helper.make_node("Mul", inputs=["out4/placeholder_port_0", "out4/placeholder_port_1"],
outputs=["out4"])
graph = make_graph([expected_split, expected_mul], "test_graph", input_tensors, output_tensors)
@@ -201,7 +201,7 @@ def create_test_onnx_models():
make_tensor_value_info("out4", onnx.TensorProto.FLOAT, (2, 2)),
]
expected_split = onnx.helper.make_node("Split", inputs=["out1/placeholder_port_0"],
outputs=["out1", "out2"])
outputs=["out1", "out2"], name="split1", axis=0)
expected_mul = onnx.helper.make_node("Mul", inputs=["out4/placeholder_port_0", "out4/placeholder_port_1"],
outputs=["out4"])
graph = make_graph([expected_split, relu, expected_mul], "test_graph", input_tensors, output_tensors)

View File

@@ -11,7 +11,6 @@ from openvino.runtime.impl.op import Constant, Parameter
from tests.runtime import get_runtime
def binary_op(op_str, a, b):
if op_str == "+":

View File

@@ -144,4 +144,3 @@ xfail_issue_63136 = xfail_test(reason="Unsupported operation: CastLike")
xfail_issue_63137 = xfail_test(reason="Unsupported operations: OptionalHasElement, OptionalGetElement")
xfail_issue_63138 = xfail_test(reason="Missing ONNX Shape-15 support")
xfail_issue_63643 = xfail_test(reason="RuntimeError: Unsupported operation of type: Convolution name")
xfail_issue_54663 = xfail_test(reason="Disabled until MaxPool-8 is supported on CPU")

View File

@@ -10,8 +10,6 @@ from ngraph.impl import AxisSet, Function, Shape, Type
from ngraph.impl.op import Constant, Parameter
from tests_compatibility.runtime import get_runtime
from tests_compatibility import xfail_issue_54663
def binary_op(op_str, a, b):