vvchernov commented on a change in pull request #8709: URL: https://github.com/apache/tvm/pull/8709#discussion_r697456678
########## 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: Thank you @t-vi ! I think other frontends needs incremental type inference. It is simply to understand by counting all calls of infer_type and infer_shape methods in frontend (~100 for onnx). In general frontends have many similarities and it moved me try to unify some duplicates. This task is not so simple as seemed before I will try to study all details around and do it carefully. -- 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: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org