Skip to content

Commit 3255971

Browse files
committed
remove uneccesary function
Change-Id: Ifc1b4c34cd891fce35d3e043ba81afdd2e34fc4e
1 parent cf3b8da commit 3255971

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

python/tvm/relay/backend/contrib/ethosu/codegen.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from tvm.relay.backend.contrib.ethosu import tir_to_cs_translator
2626
from tvm.relay.backend.contrib.ethosu import util
2727
from tvm.relay.backend.contrib.ethosu import op as ethosu_op
28-
from tvm.relay.backend.contrib.ethosu.util import is_ethosu_op
2928
from tvm.relay.expr_functor import ExprMutator
3029
from tvm.relay.backend.contrib.ethosu.op import op_attrs # pylint: disable=unused-import
3130

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

151-
print(new_call)
152-
153150
return super().visit_call(new_call)
154151

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

python/tvm/relay/backend/contrib/ethosu/util.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -139,26 +139,6 @@ def is_composite_func(func: relay.Function, name: str) -> bool:
139139
return composite_name == name
140140

141141

142-
def is_ethosu_op(expr: tvm.relay.Expr) -> bool:
143-
"""Checks whether a relay expression is an NPU operator or not.
144-
145-
Parameters
146-
----------
147-
expr : tvm.relay.Expr
148-
The expression to check.
149-
150-
Returns
151-
-------
152-
bool
153-
True if the expression is an EthosU operation, false if not.
154-
"""
155-
return (
156-
isinstance(expr, tvm.relay.expr.Call)
157-
and isinstance(expr.op, tvm.ir.op.Op)
158-
and "contrib.ethosu" in expr.op.name
159-
)
160-
161-
162142
def get_range_for_dtype_str(dtype: str) -> Tuple[int, int]:
163143
"""
164144
Produce the min,max for a give data type.

0 commit comments

Comments
 (0)