From 213a6ef11f91abd38dc5ee5cd7c1b19648b37795 Mon Sep 17 00:00:00 2001 From: Wang Yuchen Date: Tue, 27 May 2025 16:41:17 +0800 Subject: [PATCH] add log --- tf_adapter_2.x/npu_device/core/npu_device.cpp | 1 + tf_adapter_2.x/npu_device/core/npu_utils.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tf_adapter_2.x/npu_device/core/npu_device.cpp b/tf_adapter_2.x/npu_device/core/npu_device.cpp index ca7c5e425..cac2af25c 100644 --- a/tf_adapter_2.x/npu_device/core/npu_device.cpp +++ b/tf_adapter_2.x/npu_device/core/npu_device.cpp @@ -1032,6 +1032,7 @@ tensorflow::Status NpuDevice::TransTfGraph2GeGraph(TFE_Context *context, const s std::map const_value_map; std::vector partition_graph; NPU_REQUIRES_OK(SeparateGraphDef(const_cast(&def), partition_graph, const_value_map)); + LOG(ERROR) << "Size: " << partition_graph.size() << "IsEmpty: " << partition_graph.front().GetLength(); NPU_REQUIRES(parser->ParseProtoWithSubgraph(partition_graph, const_value_map, request_subgraph, ge_compute_graph) == ge::SUCCESS, tensorflow::errors::Internal("NPU Parse tensorflow model failed")); diff --git a/tf_adapter_2.x/npu_device/core/npu_utils.cpp b/tf_adapter_2.x/npu_device/core/npu_utils.cpp index e005c5599..7e7e0c4a2 100644 --- a/tf_adapter_2.x/npu_device/core/npu_utils.cpp +++ b/tf_adapter_2.x/npu_device/core/npu_utils.cpp @@ -512,8 +512,10 @@ void NpuCustomizedOptimizeGraph(tensorflow::FunctionLibraryRuntime &lib, std::un tensorflow::Status SeparateGraphDef(tensorflow::GraphDef *def, std::vector &partition_graph, std::map &const_value_map) { + LOG(ERROR) << "Enter SeparateGraphDef"; std::string def_str = def->SerializeAsString(); if (!def_str.empty()) { + LOG(ERROR) << "def_str is not empty" << def_str.length(); partition_graph.push_back(ge::AscendString(def_str.c_str(), def_str.length())); return tensorflow::Status::OK(); } @@ -533,8 +535,9 @@ tensorflow::Status SeparateGraphDef(tensorflow::GraphDef *def, ge::AscendString(tensor_str.c_str(), tensor_str.length())}); node.mutable_attr()->erase(iter); } - } + } def_str = def->SerializeAsString(); + LOG(ERROR) << "def_str : " << def_str.length(); partition_graph.push_back(ge::AscendString(def_str.c_str(), def_str.length())); return tensorflow::Status::OK(); } -- Gitee