not set debug_info for top_graph's call_node

This commit is contained in:
huanghui 2021-10-09 11:24:07 +08:00
parent ac4852b8af
commit 23b5d2a23c
1 changed files with 6 additions and 2 deletions

View File

@ -2185,17 +2185,21 @@ FuncGraphPtr MakeTopGraph(const py::object &cell, const ValuePtr &cell_ptr) {
}
auto unpacking = func_graph->has_vararg() || func_graph->has_kwarg();
TraceGuard guard(current_graph->get_return()->debug_info()->location());
if (!unpacking) {
std::vector<AnfNodePtr> inputs;
inputs.emplace_back(NewValueNode(cell_ptr));
auto &params = func_graph->parameters();
(void)std::transform(params.begin(), params.end(), std::back_inserter(inputs),
[](AnfNodePtr node) -> AnfNodePtr { return node; });
func_graph->set_output(func_graph->NewCNodeInOrder(std::move(inputs)));
auto call_node = func_graph->NewCNodeInOrder(std::move(inputs));
TraceGuard guard(current_graph->get_return()->debug_info()->location());
func_graph->set_output(call_node);
} else {
// ret = cell_obj(*arg, *kwargs)
auto call_fn = MakeUnpackCall(func_graph, NewValueNode(cell_ptr), func_graph->parameters());
TraceGuard guard(current_graph->get_return()->debug_info()->location());
// Set output as ret
func_graph->set_output(call_fn);
}