Skip to content

Commit

Permalink
Resolve pylint warnings under aimet_onnx package
Browse files Browse the repository at this point in the history
Signed-off-by: Geunho Lee <quic_geunlee@quicinc.com>
  • Loading branch information
quic-geunlee authored and quic-akhobare committed Nov 1, 2023
1 parent d6e9ebc commit d8f7f35
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
import numpy as np
import onnxruntime as ort
import onnx
from packaging import version

from aimet_common.utils import AimetLogger
from aimet_onnx.quantsim import QuantizationSimModel
from aimet_onnx.utils import add_hook_to_get_activation, remove_activation_hooks, create_input_dict

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import torch
import torch.nn.functional as functional
from torch.utils.data import Dataset
from packaging import version

# Import AIMET specific modules
from aimet_common.utils import AimetLogger
Expand All @@ -56,7 +57,6 @@
from aimet_torch.adaround.adaround_tensor_quantizer import AdaroundTensorQuantizer
from aimet_torch.adaround.adaround_optimizer import AdaroundOptimizer as TorchAdaroundOptimizer

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
from typing import Dict
from collections import defaultdict
import onnx
from packaging import version

from aimet_onnx.meta.connectedgraph import ConnectedGraph

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import numpy as np
import onnx
from onnx import numpy_helper
from packaging import version

from aimet_common.bias_correction import ConvBnPatternHandler
from aimet_common.graph_pattern_matcher import PatternType
Expand All @@ -54,7 +55,6 @@
from aimet_onnx.meta.operations import Op
from aimet_onnx.utils import get_node_attribute, remove_node, transpose_tensor, ParamUtils, retrieve_constant_input

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import NodeProto, TensorProto, ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import onnx
from onnx import numpy_helper
from onnxruntime.quantization.onnx_quantizer import ONNXModel
from packaging import version

from aimet_common.utils import AimetLogger
from aimet_common.connected_graph.connectedgraph import get_ordered_ops
Expand All @@ -59,7 +60,6 @@
from aimet_onnx.utils import transpose_tensor, ParamUtils, get_node_attribute, replace_relu6_with_relu
from aimet_onnx.batch_norm_fold import BNLayer, fold_all_batch_norms_to_weight

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import NodeProto, ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
import numpy as np
import onnxruntime as ort
import onnx
from packaging import version

from aimet_common.utils import AimetLogger
from aimet_common.layer_output_utils import SaveInputOutput, save_layer_output_names

from aimet_onnx.quantsim import QuantizationSimModel
from aimet_onnx.utils import create_input_dict, add_hook_to_get_activation

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from typing import List, Union, Dict
from onnxruntime.quantization.onnx_quantizer import ONNXModel
import onnx
from packaging import version

from aimet_common.connected_graph.connectedgraph import ConnectedGraph as AimetCommonConnectedGraph, get_ordered_ops
from aimet_common.utils import AimetLogger
Expand All @@ -55,7 +56,6 @@
from aimet_onnx.meta.product import Product
from aimet_onnx.utils import ParamUtils, retrieve_constant_input

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto, NodeProto, TensorProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
""" Utilities for ONNX Connected Graph """
from typing import Dict, List
import onnx
from packaging import version

from aimet_onnx.meta.connectedgraph import ConnectedGraph

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
2 changes: 1 addition & 1 deletion TrainingExtensions/onnx/src/python/aimet_onnx/quantsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import onnxruntime as ort
from onnxruntime import SessionOptions, GraphOptimizationLevel, InferenceSession
from onnxruntime.quantization.onnx_quantizer import ONNXModel
from packaging import version

from aimet_common import libpymo
from aimet_common import libquant_info
Expand All @@ -60,7 +61,6 @@
from aimet_onnx.quantsim_config.quantsim_config import QuantSimConfigurator
from aimet_onnx.utils import make_dummy_input, add_hook_to_get_activation, remove_activation_hooks

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from typing import List, Dict, Tuple

import onnx
from packaging import version

from aimet_common.defs import QuantizationDataType
from aimet_common.graph_searcher import GraphSearcher
Expand All @@ -52,7 +53,6 @@
from aimet_onnx.utils import get_product_name_from_quantized_name
from aimet_onnx.qc_quantize_op import OpMode, QcQuantizeOp

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import ModelProto, NodeProto
Expand Down
3 changes: 2 additions & 1 deletion TrainingExtensions/onnx/src/python/aimet_onnx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
import numpy as np
import onnx
from onnx import helper, numpy_helper, mapping
from packaging import version

from aimet_common.utils import AimetLogger

from packaging import version
# pylint: disable=no-name-in-module, ungrouped-imports
if version.parse(onnx.__version__) >= version.parse("1.14.0"):
from onnx import NodeProto, TensorProto, ModelProto, GraphProto, ValueInfoProto
Expand Down

0 comments on commit d8f7f35

Please sign in to comment.