chunit-quic commented on code in PR #13402:
URL: https://github.com/apache/tvm/pull/13402#discussion_r1046840499
##########
python/tvm/relay/frontend/common.py:
##########
@@ -997,3 +1002,167 @@ def try_resolve_var_to_const(x, graph_params):
return _op.const(value, dtype)
return x
+
+
+class _SpanFiller(ExprMutator):
+ """SpanFiller"""
+
+ def __init__(self, span):
+ ExprMutator.__init__(self)
+ if isinstance(span, tvm.relay.Span):
+ self._span = span
+ elif isinstance(span, str):
+ self._span = tvm.relay.Span(tvm.relay.SourceName(span), 0, 0, 0, 0)
+ elif isinstance(span, bytes):
+ self._span =
tvm.relay.Span(tvm.relay.SourceName(span.decode("utf-8")), 0, 0, 0, 0)
+ else:
+ assert False, f"unsupported span type: {type(span)}"
+
+ def visit(self, expr):
+ if hasattr(expr, "span") and expr.span:
+ return expr
+
+ return super().visit(expr)
+
+ def visit_function(self, fn):
+ new_params = [self.visit(x) for x in fn.params]
+ new_body = self.visit(fn.body)
+ return _function.Function(
Review Comment:
Yes, I have changed them in the latest patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]