diff --git a/mindspore/ccsrc/debug/debugger/proto_exporter.cc b/mindspore/ccsrc/debug/debugger/proto_exporter.cc index f07885538a..a0ba4e0b3e 100644 --- a/mindspore/ccsrc/debug/debugger/proto_exporter.cc +++ b/mindspore/ccsrc/debug/debugger/proto_exporter.cc @@ -40,9 +40,7 @@ void CheckIfValidType(const TypePtr &type, debugger::TypeProto *type_proto) { type->isa() || type->isa())) { MS_LOG(EXCEPTION) << "Unknown type: " << type->type_name(); } - if (type == nullptr) { - type_proto->set_data_type(debugger::DT_UNDEFINED); - } else if (type->isa()) { + if (type->isa()) { type_proto->set_data_type(GetDebuggerNumberDataType(type)); } } @@ -52,9 +50,11 @@ void DebuggerProtoExporter::SetNodeOutputType(const TypePtr &type, const BaseSha if (type_proto == nullptr) { return; } - if (type != nullptr) { - CheckIfValidType(type, type_proto); + if (type == nullptr) { + type_proto->set_data_type(debugger::DT_UNDEFINED); + return; } + CheckIfValidType(type, type_proto); if (type->isa()) { TypePtr elem_type = dyn_cast(type)->element(); type_proto->mutable_tensor_type()->set_elem_type(GetDebuggerNumberDataType(elem_type));