Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Hzfengsy committed Oct 2, 2024
1 parent 3666765 commit feed4d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/tvm/relax/frontend/onnx/onnx_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

import numpy as _np
import onnx.onnx_ml_pb2
from onnx import helper

import tvm
from tvm import TVMError, relax, tir, topi
Expand All @@ -56,7 +55,14 @@ def get_type(elem_type: Union[str, int]) -> str:
if isinstance(elem_type, str):
return elem_type

return str(helper.tensor_dtype_to_np_dtype(elem_type))
try:
from onnx.mapping import ( # pylint: disable=import-outside-toplevel
TENSOR_TYPE_TO_NP_TYPE,
)
except ImportError as exception:
raise ImportError("Unable to import onnx which is required {}".format(exception))

return str(TENSOR_TYPE_TO_NP_TYPE[elem_type])


def get_constant(
Expand Down Expand Up @@ -259,7 +265,7 @@ def _impl_v1(cls, bb, inputs, attr, params):
)
return relax.PrimValue(cls.numpy_op(x, y)) # pylint: disable=not-callable

return cls.relax_op(inputs[0], inputs[1])
return cls.relax_op(inputs[0], inputs[1]) # pylint: disable=not-callable


class Add(BinaryBase):
Expand Down

0 comments on commit feed4d2

Please sign in to comment.