Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to visit the arguments of inlined functions #4783

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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