lixiaoquan commented on a change in pull request #5797:
URL: https://github.com/apache/incubator-tvm/pull/5797#discussion_r440584386
##########
File path: src/relay/transforms/merge_composite.cc
##########
@@ -36,22 +36,24 @@ namespace tvm {
namespace relay {
namespace merge_composite {
-Function InferType(const Function& expr) {
- auto mod = IRModule::FromExpr(expr);
+Function InferType(const Function& expr, const IRModule& m) {
+ IRModule mod(m);
+ mod->Update(mod->GetGlobalVar("main"), expr);
Review comment:
> Since now we update the original module with new transformed function,
should we update the corresponding function instead of `main`?
For now, other functions in module don't call 'main', so it is safe to
replace 'main'. If we are infering function which is mutated from 'main',
that's just what we want, if we are infering other functions, it will be a
duplicated function but it doesn't harm. And, with only a mutated function, it
seems we can't find it in original global_var_map_ because we don't know its
crossponding global variable's name.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]