Skip to content

Commit

Permalink
Make sure to visit the arguments of inlined functions (#4783)
Browse files Browse the repository at this point in the history
  • Loading branch information
abergeron authored Jan 30, 2020
1 parent 1b8522e commit 6798ba8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/relay/backend/vm/inline_primitives.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6798ba8

Please sign in to comment.