From 97cbec9b74bc9ddf137608e95cecb93f352153d4 Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Tue, 27 Nov 2018 19:02:29 +0800 Subject: [PATCH] clean code --- .../operators/distributed/parameter_prefetch.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/operators/distributed/parameter_prefetch.cc b/paddle/fluid/operators/distributed/parameter_prefetch.cc index d2b514b7b..13fc0bc0c 100644 --- a/paddle/fluid/operators/distributed/parameter_prefetch.cc +++ b/paddle/fluid/operators/distributed/parameter_prefetch.cc @@ -37,9 +37,7 @@ using LoDTensor = framework::LoDTensor; using SelectedRows = framework::SelectedRows; using DDim = framework::DDim; -constexpr int64_t kNoPadding = -1; - -inline size_t GetSectionIndex(int64_t id, +static size_t GetSectionIndex(int64_t id, const std::vector& abs_sections) { for (size_t i = 1; i < abs_sections.size(); ++i) { if (id < abs_sections[i]) { @@ -49,7 +47,7 @@ inline size_t GetSectionIndex(int64_t id, return abs_sections.size() - 1; } -inline std::vector ToAbsoluteSection( +static std::vector ToAbsoluteSection( const std::vector& height_sections) { std::vector abs_sections; abs_sections.resize(height_sections.size()); @@ -60,7 +58,7 @@ inline std::vector ToAbsoluteSection( return abs_sections; } -inline std::vector> SplitIds( +static std::vector> SplitIds( const std::string& id_name, const std::vector& height_section, framework::Scope* scope) { auto& id_tensor = scope->FindVar(id_name)->Get(); @@ -79,7 +77,7 @@ inline std::vector> SplitIds( return splited_ids; } -inline void SplitIdsIntoMultipleVarsBySection( +static void SplitIdsIntoMultipleVarsBySection( const std::string& id_name, const std::vector& in_var_names, const std::vector& height_section, const std::vector>& splited_ids, @@ -100,7 +98,7 @@ inline void SplitIdsIntoMultipleVarsBySection( } } -inline void MergeMultipleVarsIntoOneBySection( +static void MergeMultipleVarsIntoOneBySection( const std::string& id_name, const std::string& out_name, const std::vector& out_var_names, const std::vector& height_section, -- GitLab