From 0c4d3a63f059bab821a5b2e7914607280631f86b Mon Sep 17 00:00:00 2001 From: zha0q1 Date: Mon, 12 Apr 2021 21:55:21 +0000 Subject: [PATCH 1/5] move _op_translation files --- python/mxnet/onnx/mx2onnx/__init__.py | 4 ++-- .../{_op_translations => }/_op_translations_opset12.py | 2 +- .../{_op_translations => }/_op_translations_opset13.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename python/mxnet/onnx/mx2onnx/{_op_translations => }/_op_translations_opset12.py (99%) rename python/mxnet/onnx/mx2onnx/{_op_translations => }/_op_translations_opset13.py (99%) diff --git a/python/mxnet/onnx/mx2onnx/__init__.py b/python/mxnet/onnx/mx2onnx/__init__.py index 339d74dd7c2d..4ed477a76e7a 100644 --- a/python/mxnet/onnx/mx2onnx/__init__.py +++ b/python/mxnet/onnx/mx2onnx/__init__.py @@ -19,5 +19,5 @@ """ONNX Export module""" from ._export_model import export_model, get_operator_support -from ._op_translations import _op_translations_opset12 -from ._op_translations import _op_translations_opset13 +from . import _op_translations_opset12 +from . import _op_translations_opset13 diff --git a/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py b/python/mxnet/onnx/mx2onnx/_op_translations_opset12.py similarity index 99% rename from python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py rename to python/mxnet/onnx/mx2onnx/_op_translations_opset12.py index d683aad7000c..df230e168265 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py +++ b/python/mxnet/onnx/mx2onnx/_op_translations_opset12.py @@ -56,7 +56,7 @@ import re import logging import numpy as np -from .._export_onnx import MXNetGraph as mx_op +from ._export_onnx import MXNetGraph as mx_op try: import onnx except ImportError: diff --git a/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py b/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py similarity index 99% rename from python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py rename to python/mxnet/onnx/mx2onnx/_op_translations_opset13.py index d0176d1a5197..1041e1d55c32 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py +++ b/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py @@ -56,7 +56,7 @@ import re import logging import numpy as np -from .._export_onnx import MXNetGraph as mx_op +from ._export_onnx import MXNetGraph as mx_op try: import onnx except ImportError: From 90e3e3b0d28fb1b88cfa256cbddac42f3b2c3cb7 Mon Sep 17 00:00:00 2001 From: zha0q1 Date: Mon, 12 Apr 2021 21:56:03 +0000 Subject: [PATCH 2/5] fix header checker path --- tools/license_header.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/license_header.py b/tools/license_header.py index 387c4445b6f1..2ebef045205e 100755 --- a/tools/license_header.py +++ b/tools/license_header.py @@ -125,8 +125,8 @@ # Dual-Licensed under Apache 2.0 and Nvidia BSD-3 'python/mxnet/onnx/mx2onnx/_export_onnx.py', 'python/mxnet/onnx/mx2onnx/_op_translations.py', - 'python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py', - 'python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py', + 'python/mxnet/onnx/mx2onnx/_op_translations_opset12.py', + 'python/mxnet/onnx/mx2onnx/_op_translations_opset13.py', # Github template '.github/ISSUE_TEMPLATE/bug_report.md', From 1a711507d02cc11378158086a668d6da9c4b433a Mon Sep 17 00:00:00 2001 From: Zhaoqi Zhu Date: Mon, 12 Apr 2021 22:46:44 -0700 Subject: [PATCH 3/5] Update _op_translations_opset13.py --- python/mxnet/onnx/mx2onnx/_op_translations_opset13.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py b/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py index 1041e1d55c32..204642f37fd0 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py +++ b/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py @@ -1282,7 +1282,7 @@ def convert_slice_channel(node, **kwargs): squeeze_axis = attrs.get('squeeze_axis', 'False') create_tensor([axis], name+'_axis', kwargs['initializer']) - + nodes = [] if squeeze_axis in ['True', '1']: nodes += [ From ddcb1cd07454c6722afba94c20a0753562ee8298 Mon Sep 17 00:00:00 2001 From: zha0q1 Date: Wed, 14 Apr 2021 21:39:46 +0000 Subject: [PATCH 4/5] fix --- python/mxnet/onnx/mx2onnx/__init__.py | 4 ++-- .../onnx/mx2onnx/_op_translation/__init__.py | 22 +++++++++++++++++++ .../_op_translations_opset12.py | 2 +- .../_op_translations_opset13.py | 2 +- tools/license_header.py | 5 ++--- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 python/mxnet/onnx/mx2onnx/_op_translation/__init__.py rename python/mxnet/onnx/mx2onnx/{ => _op_translation}/_op_translations_opset12.py (99%) rename python/mxnet/onnx/mx2onnx/{ => _op_translation}/_op_translations_opset13.py (99%) diff --git a/python/mxnet/onnx/mx2onnx/__init__.py b/python/mxnet/onnx/mx2onnx/__init__.py index 4ed477a76e7a..f6c021e4b870 100644 --- a/python/mxnet/onnx/mx2onnx/__init__.py +++ b/python/mxnet/onnx/mx2onnx/__init__.py @@ -19,5 +19,5 @@ """ONNX Export module""" from ._export_model import export_model, get_operator_support -from . import _op_translations_opset12 -from . import _op_translations_opset13 +from ._op_translation import _op_translations_opset12 +from ._op_translation import _op_translations_opset13 diff --git a/python/mxnet/onnx/mx2onnx/_op_translation/__init__.py b/python/mxnet/onnx/mx2onnx/_op_translation/__init__.py new file mode 100644 index 000000000000..d9cfd16229cb --- /dev/null +++ b/python/mxnet/onnx/mx2onnx/_op_translation/__init__.py @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# coding: utf-8 +"""ONNX Export module""" + +from . import _op_translations_opset12 +from . import _op_translations_opset13 diff --git a/python/mxnet/onnx/mx2onnx/_op_translations_opset12.py b/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset12.py similarity index 99% rename from python/mxnet/onnx/mx2onnx/_op_translations_opset12.py rename to python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset12.py index df230e168265..d683aad7000c 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translations_opset12.py +++ b/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset12.py @@ -56,7 +56,7 @@ import re import logging import numpy as np -from ._export_onnx import MXNetGraph as mx_op +from .._export_onnx import MXNetGraph as mx_op try: import onnx except ImportError: diff --git a/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py b/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset13.py similarity index 99% rename from python/mxnet/onnx/mx2onnx/_op_translations_opset13.py rename to python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset13.py index 204642f37fd0..df137644b151 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translations_opset13.py +++ b/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset13.py @@ -56,7 +56,7 @@ import re import logging import numpy as np -from ._export_onnx import MXNetGraph as mx_op +from .._export_onnx import MXNetGraph as mx_op try: import onnx except ImportError: diff --git a/tools/license_header.py b/tools/license_header.py index 2ebef045205e..ccc45bdb3be1 100755 --- a/tools/license_header.py +++ b/tools/license_header.py @@ -124,9 +124,8 @@ # Dual-Licensed under Apache 2.0 and Nvidia BSD-3 'python/mxnet/onnx/mx2onnx/_export_onnx.py', - 'python/mxnet/onnx/mx2onnx/_op_translations.py', - 'python/mxnet/onnx/mx2onnx/_op_translations_opset12.py', - 'python/mxnet/onnx/mx2onnx/_op_translations_opset13.py', + 'python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py', + 'python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py', # Github template '.github/ISSUE_TEMPLATE/bug_report.md', From 931948984b8552d48ca16473d6361d41d97f7b41 Mon Sep 17 00:00:00 2001 From: zha0q1 Date: Wed, 14 Apr 2021 21:45:15 +0000 Subject: [PATCH 5/5] fix --- python/mxnet/onnx/mx2onnx/__init__.py | 4 ++-- .../mx2onnx/{_op_translation => _op_translations}/__init__.py | 2 +- .../_op_translations_opset12.py | 0 .../_op_translations_opset13.py | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename python/mxnet/onnx/mx2onnx/{_op_translation => _op_translations}/__init__.py (96%) rename python/mxnet/onnx/mx2onnx/{_op_translation => _op_translations}/_op_translations_opset12.py (100%) rename python/mxnet/onnx/mx2onnx/{_op_translation => _op_translations}/_op_translations_opset13.py (100%) diff --git a/python/mxnet/onnx/mx2onnx/__init__.py b/python/mxnet/onnx/mx2onnx/__init__.py index f6c021e4b870..339d74dd7c2d 100644 --- a/python/mxnet/onnx/mx2onnx/__init__.py +++ b/python/mxnet/onnx/mx2onnx/__init__.py @@ -19,5 +19,5 @@ """ONNX Export module""" from ._export_model import export_model, get_operator_support -from ._op_translation import _op_translations_opset12 -from ._op_translation import _op_translations_opset13 +from ._op_translations import _op_translations_opset12 +from ._op_translations import _op_translations_opset13 diff --git a/python/mxnet/onnx/mx2onnx/_op_translation/__init__.py b/python/mxnet/onnx/mx2onnx/_op_translations/__init__.py similarity index 96% rename from python/mxnet/onnx/mx2onnx/_op_translation/__init__.py rename to python/mxnet/onnx/mx2onnx/_op_translations/__init__.py index d9cfd16229cb..ba26e207eb4c 100644 --- a/python/mxnet/onnx/mx2onnx/_op_translation/__init__.py +++ b/python/mxnet/onnx/mx2onnx/_op_translations/__init__.py @@ -16,7 +16,7 @@ # under the License. # coding: utf-8 -"""ONNX Export module""" +"""ONNX export op translation""" from . import _op_translations_opset12 from . import _op_translations_opset13 diff --git a/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset12.py b/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py similarity index 100% rename from python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset12.py rename to python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py diff --git a/python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset13.py b/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py similarity index 100% rename from python/mxnet/onnx/mx2onnx/_op_translation/_op_translations_opset13.py rename to python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset13.py