masahi commented on a change in pull request #8709:
URL: https://github.com/apache/tvm/pull/8709#discussion_r697250903
##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -148,29 +146,13 @@ def infer_type(self, node, mod=None):
if node in self.types:
return self.types[node]
- if isinstance(node, tvm.relay.Var):
- return node.type_annotation
-
- tf = _TypeFinder(types=self.types)
- new_node = tf.visit(node)
- fn = _function.Function(list(tf.vars.values()), new_node)
- new_mod = IRModule({"main": fn})
- if mod is not None:
- new_mod.update(mod)
- new_mod = transform.RemoveUnusedFunctions()(new_mod)
- new_mod = transform.InferType()(new_mod)
- entry = new_mod["main"]
- ty = entry.body.checked_type
- self.types[node] = ty
- return self.types[node]
Review comment:
Other changes look good, but this change effectively makes `_TypeFinder`
class a dead code, so it probably is not a good idea to remove it. And
`infer_type(...)` is certainly not incremental. I haven't really taken a deep
look at the code, but you can assume that there have been no progress on
incremental type inference since #6900.
So I'd suggest revert this change which could be controversial, and I'll
merge other easy changes.
--
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]