From a266292a57613d16806cccd939d68f436731927c Mon Sep 17 00:00:00 2001 From: zlx Date: Wed, 21 Jun 2017 18:37:37 +0800 Subject: [PATCH] modify format --- paddle/parameter/ParameterUpdaterHook.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/paddle/parameter/ParameterUpdaterHook.cpp b/paddle/parameter/ParameterUpdaterHook.cpp index ba2cb37fa2..968803fc0f 100644 --- a/paddle/parameter/ParameterUpdaterHook.cpp +++ b/paddle/parameter/ParameterUpdaterHook.cpp @@ -71,10 +71,9 @@ public: for (size_t i = 0; i < para->getSize(); i++) param.push_back(std::make_pair(fabs(paraCpuCopy->getData()[i]), i)); - std::partial_sort(param.begin(), param.begin() + nonZeroNum, param.end(), - sortPairAscend); - for (size_t i = 0; i < nonZeroNum; i++) - maskTempData[param[i].second] = 1.0; + std::partial_sort( + param.begin(), param.begin() + nonZeroNum, param.end(), sortPairAscend); + for (size_t i = 0; i < nonZeroNum; i++) maskTempData[param[i].second] = 1.0; // Currently just use a mask vector for hack. if (para->useGpu()) { @@ -127,14 +126,16 @@ private: std::hash intHasher_; }; -static WeakKVCache, IParameterUpdaterHook, - StringIntPairHasher> g_hookCache_; +static WeakKVCache, + IParameterUpdaterHook, + StringIntPairHasher> + g_hookCache_; /** * ParameterUpdaterHook actually factory method. */ -static IParameterUpdaterHook * -createImpl(const ParameterUpdaterHookConfig &config) { +static IParameterUpdaterHook *createImpl( + const ParameterUpdaterHookConfig &config) { auto &type = config.type(); if (type == "pruning") { return new StaticPruningHook(config); @@ -144,11 +145,11 @@ createImpl(const ParameterUpdaterHookConfig &config) { return nullptr; } -std::shared_ptr -IParameterUpdaterHook::create(const ParameterConfig ¶mConfig, int idx) { +std::shared_ptr IParameterUpdaterHook::create( + const ParameterConfig ¶mConfig, int idx) { std::pair key = {paramConfig.name(), idx}; return g_hookCache_.get( key, [&] { return createImpl(paramConfig.update_hooks(idx)); }); } -} // namespace paddle +} // namespace paddle -- GitLab