diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter.cc b/mindspore/ccsrc/debug/debugger/proto_exporter.cc index 6622af14cd2..97dfca9ec11 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter.cc +++ b/mindspore/ccsrc/debug/debugger/proto_exporter.cc @@ -438,14 +438,14 @@ void DebuggerProtoExporter::ExportCNode(const FuncGraphPtr &func_graph, const CN // add full_name for debugger node_proto->set_full_name(node->fullname_with_scope()); MS_LOG(INFO) << "full_name: " << node->fullname_with_scope(); - if (dump_location == kDebugWholeStack) { - std::ostringstream buffer; - auto traces = mindspore::trace::GetSourceLineList(node); - for (auto &trace : traces) { - buffer << " # " << trace; - } - node_proto->set_source_address(buffer.str()); + + std::ostringstream buffer; + auto traces = mindspore::trace::GetSourceLineList(node); + for (auto &trace : traces) { + buffer << " # " << trace; } + node_proto->set_source_address(buffer.str()); + // process OP inputs for (size_t i = 1; i < inputs.size(); ++i) { debugger::InputProto *input_proto = node_proto->add_input(); diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter.h b/mindspore/ccsrc/debug/debugger/proto_exporter.h index 9e8942d6d3b..a004abb7767 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter.h +++ b/mindspore/ccsrc/debug/debugger/proto_exporter.h @@ -34,7 +34,8 @@ class DebuggerProtoExporter { DebuggerProtoExporter() {} ~DebuggerProtoExporter() {} - std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph, LocDebugDumpMode dump_location = kDebugOff); + std::string GetFuncGraphProtoString(const FuncGraphPtr &func_graph, + LocDebugDumpMode dump_location = kDebugWholeStack); debugger::ModelProto GetFuncGraphProto(const FuncGraphPtr &func_graph); private: @@ -49,13 +50,13 @@ class DebuggerProtoExporter { void SetDictionaryToProto(const ValueDictionaryPtr &val, debugger::ValueProto *value_proto); void SetNodeOutputType(const AnfNodePtr &node, debugger::TypeProto *type_proto); void ExportFuncGraph(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto, - LocDebugDumpMode dump_location = kDebugOff); + LocDebugDumpMode dump_location = kDebugWholeStack); void ExportParameters(const FuncGraphPtr &func_graph, debugger::GraphProto *graph_proto); void ExportCNodes(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto, - std::map *const_map_ptr, LocDebugDumpMode dump_location = kDebugOff); + std::map *const_map_ptr, LocDebugDumpMode dump_location = kDebugWholeStack); void ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node, std::map *apply_map_ptr, std::map *const_map_ptr, debugger::GraphProto *const graph_proto, - LocDebugDumpMode dump_location = kDebugOff); + LocDebugDumpMode dump_location = kDebugWholeStack); void ExportFuncGraphOutput(const FuncGraphPtr &func_graph, const CNodePtr &ret_node, const std::map &apply_map, std::map *const_map_ptr, debugger::GraphProto *graph_proto); @@ -66,6 +67,6 @@ class DebuggerProtoExporter { debugger::ModelProto model_; }; void DumpIRProtoWithSrcInfo(const FuncGraphPtr &func_graph, const std::string &suffix, const std::string &target_dir, - LocDebugDumpMode dump_location = kDebugOff); + LocDebugDumpMode dump_location = kDebugWholeStack); } // namespace mindspore #endif // MINDSPORE_CCSRC_DEBUG_DEBUGGER_MINDSPORE_PROTO_EXPORTER_H_ diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter_stub.h b/mindspore/ccsrc/debug/debugger/proto_exporter_stub.h index 21d4ac1a99a..2457098caf9 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter_stub.h +++ b/mindspore/ccsrc/debug/debugger/proto_exporter_stub.h @@ -22,7 +22,7 @@ namespace mindspore { enum LocDebugDumpMode { kDebugOff = 0, kDebugTopStack = 1, kDebugWholeStack = 2 }; void DumpIRProtoWithSrcInfo(const FuncGraphPtr &func_graph, const std::string &suffix, const std::string &target_dir, - LocDebugDumpMode dump_location = kDebugOff) { + LocDebugDumpMode dump_location = kDebugWholeStack) { return; } } // namespace mindspore