Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunderberg committed Mar 13, 2024
1 parent 6493a71 commit 559cae7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
8 changes: 4 additions & 4 deletions python/tvm/relax/frontend/nn/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ def wrap_nested(expr: rx.Expr, name: str) -> Union[Tensor, Sequence[Tensor]]:
# struct info for a nested expression should be doable in
# a free function, without requiring an active
# BlockBuilder and an active scope.
bb = BlockBuilder()
with bb.function("dummy_scope", params=[]):
expr = bb.normalize(expr)
bb.emit_func_output([])
builder = BlockBuilder()
with builder.function("dummy_scope", params=[]):
expr = builder.normalize(expr)
builder.emit_func_output([])
else:
expr = BlockBuilder.current().emit(expr, name)
if isinstance(expr.struct_info_, TensorStructInfo):
Expand Down
10 changes: 0 additions & 10 deletions python/tvm/relax/frontend/nn/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ def _emit_method( # pylint: disable=too-many-locals,too-many-branches,too-many-
effects: typing.Optional[typing.List[typing.Tuple[str, core.Effect]]],
):
# pylint: disable=protected-access
# symbolic shape's name mapping to its tir.Var for reuse
str2var_params: typing.Dict[str, tir.Var] = {}

def _unwrap_ret(expr: typing.Any) -> typing.Any:
if isinstance(expr, (core.Tensor, core.Object)):
Expand All @@ -189,14 +187,6 @@ def _convert_input(arg):
raise TypeError(f"Unsupported input type: {type(arg)}")

def _params(mode: str) -> typing.List[rx.Var]:
def _get_var(shape_var: tir.Var) -> tir.Var:
name = shape_var.name
if name in str2var_params:
return str2var_params[name]
var = tir.Var(name, "int64")
str2var_params[name] = var
return var

param_vars: typing.List[rx.Var] = [
rx.Var(name, rx.TensorStructInfo(param.shape, param.dtype)) for name, param in params
]
Expand Down
4 changes: 3 additions & 1 deletion python/tvm/relax/frontend/nn/replace_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Pattern matching in SLM"""


import inspect
from typing import Dict, Tuple, List
Expand Down Expand Up @@ -116,7 +118,7 @@ def transform(mod, _context):
return transform


def _no_op_init__(self):
def _no_op_init__(self): # pylint: ignore=unused-argument
pass


Expand Down
4 changes: 2 additions & 2 deletions python/tvm/relax/frontend/nn/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import inspect
import typing

import tvm

if typing.TYPE_CHECKING:
from .core import Module as nn_module_class

Expand All @@ -26,8 +28,6 @@
ModuleSpecType = typing.Union["ModuleSpec", typing.Dict[str, MethodSpecType]]
SpecAny = typing.Union["Object", "Int", "Tensor", "Tuple"]

import tvm


class Int: # pylint: disable=too-few-public-methods
"""An integer input"""
Expand Down

0 comments on commit 559cae7

Please sign in to comment.