From 506df189b4ecca5324c5236c1ef22f3e9e460002 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Thu, 18 Feb 2021 15:11:16 +0800 Subject: [PATCH] display model info --- ge/common/helper/model_helper.cc | 13 ------------- ge/session/omg.cc | 16 ++++++++-------- inc/framework/omg/omg.h | 2 +- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 073cad29..7de7d8e0 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -78,19 +78,6 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil Status ModelHelper::SaveSizeToModelDef(const GeModelPtr &ge_model) { vector om_info; - ModelPtr model_tmp = ge::MakeShared(ge_model->GetName(), ge_model->GetPlatformVersion()); - if (model_tmp == nullptr) { - GELOGE(FAILED, "Create Model %s Ptr failed", ge_model->GetName().c_str()); - return FAILED; - } - model_tmp->SetGraph(ge_model->GetGraph()); - model_tmp->SetVersion(ge_model->GetVersion()); - model_tmp->SetAttr(ge_model->MutableAttrMap()); - ge::Buffer model_buffer; - (void)model_tmp->Save(model_buffer); - GELOGD("SaveSizeToModelDef modeldef_size is %zu", model_buffer.GetSize()); - om_info.push_back(model_buffer.GetSize()); - auto ge_model_weight = ge_model->GetWeight(); GELOGD("SaveSizeToModelDef weight_data_size is %zu, %p", ge_model_weight.GetSize(), ge_model_weight.GetData()); om_info.push_back(ge_model_weight.GetSize()); diff --git a/ge/session/omg.cc b/ge/session/omg.cc index bbc674ec..a82db26b 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -71,7 +71,7 @@ const char *const kOutputTypeError = "The multiple out nodes set in output_type const size_t kNodeNameIndex = 0; const size_t kIndexStrIndex = 1; const size_t kDTValueIndex = 2; -const size_t kOmInfoSize = 5; +const size_t kOmInfoSize = 4; } // namespace // When the model is converted to a JSON file, the following operator attributes in the blacklist will be ignored @@ -828,7 +828,7 @@ void GetGroupName(ge::proto::ModelDef &model_def) { }); } -FMK_FUNC_HOST_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def) { +FMK_FUNC_HOST_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def, uint32_t modeldef_size) { std::cout << "============ Display Model Info start ============" << std::endl; auto model_attr_map = model_def->mutable_attr(); @@ -879,15 +879,15 @@ FMK_FUNC_HOST_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def) { if (list_size == kOmInfoSize) { std::cout << "om info: " << "modeldef_size" - << "[" << iter->second.list().i(0) << " B], " + << "[" << modeldef_size << " B], " << "weight_data_size" - << "[" << iter->second.list().i(1) << " B], " + << "[" << iter->second.list().i(0) << " B], " << "tbe_kernels_size" - << "[" << iter->second.list().i(2) << " B], " + << "[" << iter->second.list().i(1) << " B], " << "cust_aicpu_kernel_store_size" - << "[" << iter->second.list().i(3) << " B], " + << "[" << iter->second.list().i(2) << " B], " << "task_info_size" - << "[" << iter->second.list().i(4) << " B]." << std::endl; + << "[" << iter->second.list().i(3) << " B]." << std::endl; } else { std::cout << "Display Model Info error, please check!" << std::endl; }; @@ -955,7 +955,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js ret = ModelSaver::SaveJsonToFile(json_file, j); } else { - PrintModelInfo(&model_def); + PrintModelInfo(&model_def, ir_part.size); } } else { ret = INTERNAL_ERROR; diff --git a/inc/framework/omg/omg.h b/inc/framework/omg/omg.h index eb25f919..be7f776f 100644 --- a/inc/framework/omg/omg.h +++ b/inc/framework/omg/omg.h @@ -104,7 +104,7 @@ GE_FUNC_VISIBILITY void UpdateOmgCtxWithParserCtx(); GE_FUNC_VISIBILITY void UpdateParserCtxWithOmgCtx(); -GE_FUNC_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def); +GE_FUNC_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def, uint32_t modeldef_size); } // namespace ge namespace domi {