File tree Expand file tree Collapse file tree 2 files changed +1
-22
lines changed
python/tvm/relay/backend/contrib/ethosu Expand file tree Collapse file tree 2 files changed +1
-22
lines changed Original file line number Diff line number Diff line change 2525from tvm .relay .backend .contrib .ethosu import tir_to_cs_translator
2626from tvm .relay .backend .contrib .ethosu import util
2727from tvm .relay .backend .contrib .ethosu import op as ethosu_op
28- from tvm .relay .backend .contrib .ethosu .util import is_ethosu_op
2928from tvm .relay .expr_functor import ExprMutator
3029from tvm .relay .backend .contrib .ethosu .op import op_attrs # pylint: disable=unused-import
3130
@@ -168,7 +167,7 @@ def visit_call(self, call: tvm.relay.expr.Call) -> tvm.relay.expr.Call:
168167 not refer to an Op. Else, a new call node with altered Op
169168 attributes.
170169 """
171- if is_ethosu_op (call ) and call .op .name != "contrib.ethosu.identity" :
170+ if isinstance (call . op , tvm . ir . op . Op ) and call .op .name in self . optimize_op :
172171 return self .alter_ethosu_op_layout (call )
173172 return super ().visit_call (call )
174173
Original file line number Diff line number Diff 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-
162142def get_range_for_dtype_str (dtype : str ) -> Tuple [int , int ]:
163143 """
164144 Produce the min,max for a give data type.
You can’t perform that action at this time.
0 commit comments