Skip to content

Commit

Permalink
remove uneccesary function
Browse files Browse the repository at this point in the history
Change-Id: Ifc1b4c34cd891fce35d3e043ba81afdd2e34fc4e
  • Loading branch information
lhutton1 committed Nov 26, 2021
1 parent cf3b8da commit 3255971
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
5 changes: 1 addition & 4 deletions python/tvm/relay/backend/contrib/ethosu/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from tvm.relay.backend.contrib.ethosu import tir_to_cs_translator
from tvm.relay.backend.contrib.ethosu import util
from tvm.relay.backend.contrib.ethosu import op as ethosu_op
from tvm.relay.backend.contrib.ethosu.util import is_ethosu_op
from tvm.relay.expr_functor import ExprMutator
from tvm.relay.backend.contrib.ethosu.op import op_attrs # pylint: disable=unused-import

Expand Down Expand Up @@ -148,8 +147,6 @@ def alter_ethosu_op_layout(self, call: tvm.relay.expr.Call) -> tvm.relay.expr.Ca
else:
self.children[input_arg] = [new_call]

print(new_call)

return super().visit_call(new_call)

def visit_call(self, call: tvm.relay.expr.Call) -> tvm.relay.expr.Call:
Expand All @@ -168,7 +165,7 @@ def visit_call(self, call: tvm.relay.expr.Call) -> tvm.relay.expr.Call:
not refer to an Op. Else, a new call node with altered Op
attributes.
"""
if is_ethosu_op(call) and call.op.name != "contrib.ethosu.identity":
if isinstance(call.op, tvm.ir.op.Op) and call.op.name in self.optimize_op:
return self.alter_ethosu_op_layout(call)
return super().visit_call(call)

Expand Down
20 changes: 0 additions & 20 deletions python/tvm/relay/backend/contrib/ethosu/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,6 @@ def is_composite_func(func: relay.Function, name: str) -> bool:
return composite_name == name


def is_ethosu_op(expr: tvm.relay.Expr) -> bool:
"""Checks whether a relay expression is an NPU operator or not.
Parameters
----------
expr : tvm.relay.Expr
The expression to check.
Returns
-------
bool
True if the expression is an EthosU operation, false if not.
"""
return (
isinstance(expr, tvm.relay.expr.Call)
and isinstance(expr.op, tvm.ir.op.Op)
and "contrib.ethosu" in expr.op.name
)


def get_range_for_dtype_str(dtype: str) -> Tuple[int, int]:
"""
Produce the min,max for a give data type.
Expand Down

0 comments on commit 3255971

Please sign in to comment.