This is an automated email from the ASF dual-hosted git repository.

liuyizhi pushed a commit to branch v0.6
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/v0.6 by this push:
     new d12e7d1  [BACKPORT-0.6] Make sure to visit the arguments of inlined 
functions (#5864)
d12e7d1 is described below

commit d12e7d15cb73629d6d42172ecff42c6dec7eff9a
Author: Yizhi Liu <[email protected]>
AuthorDate: Sat Jun 20 19:51:24 2020 -0700

    [BACKPORT-0.6] Make sure to visit the arguments of inlined functions (#5864)
    
    Co-authored-by: abergeron <[email protected]>
    
    Co-authored-by: abergeron <[email protected]>
---
 src/relay/backend/vm/inline_primitives.cc | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/relay/backend/vm/inline_primitives.cc 
b/src/relay/backend/vm/inline_primitives.cc
index 3bb1458..ec8544f 100644
--- a/src/relay/backend/vm/inline_primitives.cc
+++ b/src/relay/backend/vm/inline_primitives.cc
@@ -87,12 +87,22 @@ struct PrimitiveInliner : ExprMutator {
 
     if (auto func = op.as<FunctionNode>()) {
       if (func->IsPrimitive()) {
-        return CallNode::make(GetRef<Function>(func), call->args, call->attrs, 
call->type_args);
+        tvm::Array<Expr> call_args;
+        for (auto arg : call->args) {
+          auto new_arg = VisitExpr(arg);
+          call_args.push_back(new_arg);
+        }
+        return CallNode::make(GetRef<Function>(func), call_args, call->attrs, 
call->type_args);
       }
     }
 
     if (auto global = op.as<GlobalVarNode>()) {
-      return CallNode::make(GetRef<GlobalVar>(global), call->args, 
call->attrs, call->type_args);
+      tvm::Array<Expr> call_args;
+      for (auto arg : call->args) {
+        auto new_arg = VisitExpr(arg);
+        call_args.push_back(new_arg);
+      }
+      return CallNode::make(GetRef<GlobalVar>(global), call_args, call->attrs, 
call->type_args);
     }
 
     return ExprMutator::VisitExpr_(call);

Reply via email to