From f0dd1201ccd020fba532eba86010c4416e80eb7e Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Sat, 2 Feb 2019 14:02:40 +0800 Subject: [PATCH] fix destructor problem test=develop --- paddle/fluid/framework/trainer_factory.cc | 2 ++ paddle/fluid/framework/trainer_factory.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/trainer_factory.cc b/paddle/fluid/framework/trainer_factory.cc index a499440f7..915d0c355 100644 --- a/paddle/fluid/framework/trainer_factory.cc +++ b/paddle/fluid/framework/trainer_factory.cc @@ -22,6 +22,8 @@ limitations under the License. */ namespace paddle { namespace framework { +trainerMap g_trainer_map; + std::string TrainerFactory::TrainerTypeList() { std::string trainer_types; for (auto iter = g_trainer_map.begin(); iter != g_trainer_map.end(); ++iter) { diff --git a/paddle/fluid/framework/trainer_factory.h b/paddle/fluid/framework/trainer_factory.h index 273cd119c..89348fd3c 100644 --- a/paddle/fluid/framework/trainer_factory.h +++ b/paddle/fluid/framework/trainer_factory.h @@ -22,7 +22,7 @@ namespace paddle { namespace framework { typedef std::shared_ptr (*CreatetrainerFunction)(); typedef std::unordered_map trainerMap; -trainerMap g_trainer_map; +extern trainerMap g_trainer_map; #define REGISTER_TRAINER_CLASS(trainer_class) \ namespace { \ -- GitLab