Fix of crashes of convert_model() when executed for different frameworks (#16968)

* Fix of class conflicts in different frameworks.

* Remove commented code.

* Moved FakeQuantWithMinMaxVars to common part.

* Fixed BOM package test.

* Removed not needed code.

* Removed not needed code.
This commit is contained in:
Anastasiia Pnevskaia
2023-04-21 19:29:38 +04:00
committed by GitHub
parent 793bbb6ee2
commit 50a6c88ea3
5 changed files with 16 additions and 14 deletions
+1 -1
View File
@@ -171,6 +171,7 @@ openvino/tools/mo/front/div.py
openvino/tools/mo/front/eltwise_n.py
openvino/tools/mo/front/ExpandDimsToUnsqueeze.py
openvino/tools/mo/front/extractor.py
openvino/tools/mo/front/FakeQuantWithMinMaxVars.py
openvino/tools/mo/front/FillToBroadcast.py
openvino/tools/mo/front/flatten_to_reshape.py
openvino/tools/mo/front/freeze_placeholder_value.py
@@ -538,7 +539,6 @@ openvino/tools/mo/front/tf/extractors/utils.py
openvino/tools/mo/front/tf/eye_ext.py
openvino/tools/mo/front/tf/eye_tf_to_eye.py
openvino/tools/mo/front/tf/fake_const_ext.py
openvino/tools/mo/front/tf/FakeQuantWithMinMaxVars.py
openvino/tools/mo/front/tf/FakeQuantWithMinMaxVars_ext.py
openvino/tools/mo/front/tf/faster_rcnn_support.json
openvino/tools/mo/front/tf/faster_rcnn_support_api_v1.10.json
@@ -1,7 +1,7 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.tf.FakeQuantWithMinMaxVars import FakeQuantWithMinMaxVarsToQuantize
from openvino.tools.mo.front.FakeQuantWithMinMaxVars import FakeQuantWithMinMaxVarsToQuantize
from openvino.tools.mo.front.common.replacement import FrontReplacementPattern
from openvino.tools.mo.graph.graph import Graph
@@ -27,7 +27,7 @@ from openvino.tools.mo.front.Pack import Pack
from openvino.tools.mo.front.TransposeOrderNormalizer import TransposeOrderNormalizer
from openvino.tools.mo.front.split_normalizer import SqueezeAxis
from openvino.tools.mo.front.tf.CropAndResizeReplacement import CropAndResizeReplacement
from openvino.tools.mo.front.tf.FakeQuantWithMinMaxVars import FakeQuantWithMinMaxVarsToQuantize
from openvino.tools.mo.front.FakeQuantWithMinMaxVars import FakeQuantWithMinMaxVarsToQuantize
from openvino.tools.mo.front.tf.MapFNTransformation import MapFNInputSlicing, MapFNOutputConcatenation,\
TensorListOutputConcatenation
from openvino.tools.mo.front.tf.TFSliceToSlice import TFSliceToSliceReplacer
@@ -70,15 +70,8 @@ def _update(cls, registered_list: list, registered_dict: dict, key: str, enabled
# print('Registering new subclasses for', cls)
for c in cls.__subclasses__():
# skip importing loaders of other frameworks
if cls.__name__ == 'Loader':
need_exclude = False
for framework in exclude_modules:
if framework in c.__module__:
need_exclude = True
break
if need_exclude:
continue
if need_exclude_class(c, exclude_modules):
continue
# Force enabling operations
if hasattr(c, 'id') and c.id in enabled_transforms or \
".".join([c.__module__, c.__name__]) in enabled_transforms:
@@ -223,6 +216,13 @@ class DependencyGraph(Graph):
return order
def need_exclude_class(class_type, excluded_frameworks):
for framework in excluded_frameworks:
if "." + framework + "." in str(class_type):
return True
return False
def get_replacers_order(transform_types: list):
"""
Gets all transforms that do not have 'op'.
@@ -245,9 +245,11 @@ def get_replacers_order(transform_types: list):
for i, replacer_cls in enumerate(replacers):
for cls_after in replacer_cls().run_before():
dependency_graph.add_edge(replacer_cls, cls_after)
if cls_after in replacers:
dependency_graph.add_edge(replacer_cls, cls_after)
for cls_before in replacer_cls().run_after():
dependency_graph.add_edge(cls_before, replacer_cls)
if cls_before in replacers:
dependency_graph.add_edge(cls_before, replacer_cls)
replacers_order = dependency_graph.determined_sort()