From 78193ea874207b11b237eab41415e5ea65c63769 Mon Sep 17 00:00:00 2001 From: guru4elephant Date: Tue, 31 Dec 2019 16:02:45 +0800 Subject: [PATCH] update resource file --- predictor/framework/resource.cpp | 49 ++++++++++++++++++++++++++++++++ predictor/framework/resource.h | 5 ++++ 2 files changed, 54 insertions(+) diff --git a/predictor/framework/resource.cpp b/predictor/framework/resource.cpp index 9b6535e6..928c8749 100644 --- a/predictor/framework/resource.cpp +++ b/predictor/framework/resource.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include "predictor/framework/resource.h" +#include #include #include "predictor/common/inner_common.h" #include "predictor/framework/kv_manager.h" @@ -41,6 +42,53 @@ int DynamicResource::initialize() { return 0; } std::shared_ptr Resource::getDB() { return db; } +std::shared_ptr Resource::get_general_model_config() { + return _config; +} + +void Resource::print_general_model_config( + const std::shared_ptr & config) { + if (config == nullptr) { + LOG(INFO) << "paddle general model config is not set"; + return; + } + LOG(INFO) << "Number of Feed Tensor: " << config->_feed_type.size(); + std::ostringstream oss; + LOG(INFO) << "Feed Type Info"; + for (auto & feed_type : config->_feed_type) { + oss << feed_type << " "; + } + LOG(INFO) << oss.str(); + oss.clear(); + oss.str(""); + LOG(INFO) << "Lod Type Info"; + + for (auto is_lod : config->_is_lod_feed) { + oss << is_lod << " "; + } + + LOG(INFO) << oss.str(); + oss.clear(); + oss.str(""); + LOG(INFO) << "Capacity Info"; + for (auto & cap : config->_capacity) { + oss << cap << " "; + } + LOG(INFO) << oss.str(); + oss.clear(); + oss.str(""); + LOG(INFO) << "Feed Shape Info"; + int tensor_idx = 0; + for (auto & shape : config->_feed_shape) { + for (auto & dim : shape) { + oss << dim << " "; + } + LOG(INFO) << "Tensor[" << tensor_idx++ << "].shape: " << oss.str(); + oss.clear(); + oss.str(""); + } +} + int DynamicResource::clear() { return 0; } int Resource::initialize(const std::string& path, const std::string& file) { @@ -130,6 +178,7 @@ int Resource::general_model_initialize( } } } + return 0; } int Resource::cube_initialize(const std::string& path, diff --git a/predictor/framework/resource.h b/predictor/framework/resource.h index 600cf211..b49e3eb9 100644 --- a/predictor/framework/resource.h +++ b/predictor/framework/resource.h @@ -87,6 +87,11 @@ class Resource { int finalize(); + std::shared_ptr get_general_model_config(); + + void print_general_model_config( + const std::shared_ptr & config); + std::shared_ptr getDB(); DynamicResource* get_dynamic_resource() { -- GitLab