diff --git a/src/relay/backend/te_compiler.cc b/src/relay/backend/te_compiler.cc index 99b7d648a6e3..bfdfb3b7390f 100644 --- a/src/relay/backend/te_compiler.cc +++ b/src/relay/backend/te_compiler.cc @@ -600,15 +600,15 @@ class LowerTensorExprMutator : public DeviceAwareExprMutator { } // Similarly transform arguments. - Array args; + Array visited_args; for (const auto& arg : call_node->args) { - args.push_back(VisitExpr(arg)); + visited_args.push_back(VisitExpr(arg)); } // Already lowered by other means so we don't need to mutate // the call but we do need to mutate the arguments if (prim_func->IsInstance()) { - return Call(call_node->op, args, call_node->attrs); + return Call(call_node->op, visited_args, call_node->attrs); } // Find the desired target device. @@ -623,10 +623,7 @@ class LowerTensorExprMutator : public DeviceAwareExprMutator { target = se_scope->target; ICHECK(target.defined()); } - Array visited_args; - for (const auto& arg : call_node->args) { - visited_args.push_back(VisitExpr(arg)); - } + // Lower the primitive function for that target. Function func = Downcast(prim_func); return MakeLoweredCall(func, visited_args, call_node->type_args, call_node->span, target); diff --git a/src/relay/op/call/call.cc b/src/relay/op/call/call.cc index 9485b72d8374..87f18e860950 100644 --- a/src/relay/op/call/call.cc +++ b/src/relay/op/call/call.cc @@ -108,8 +108,7 @@ CallLoweredProps GetCallLoweredProps(const CallNode* call_node) { const auto* attrs = call_node->attrs.as(); ICHECK(attrs) << "Expected call_lowered op to have CallLoweredAttrs, but found " << call_node->attrs->GetTypeKey(); - return CallLoweredProps{std::move(GetRef(function)), std::move(tuple_args->fields), - std::move(*attrs)}; + return CallLoweredProps{GetRef(function), tuple_args->fields, *attrs}; } } // namespace relay