From 5856c2f3320181b7001335f0081308527bfa18fe Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Mon, 26 Nov 2018 10:13:50 +0800 Subject: [PATCH] change Var to FindVar --- paddle/fluid/operators/distributed/parameter_prefetch.cc | 7 ++++--- paddle/fluid/operators/lookup_table_op.h | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/distributed/parameter_prefetch.cc b/paddle/fluid/operators/distributed/parameter_prefetch.cc index b7ba938cf..327c8cb4d 100644 --- a/paddle/fluid/operators/distributed/parameter_prefetch.cc +++ b/paddle/fluid/operators/distributed/parameter_prefetch.cc @@ -63,7 +63,7 @@ inline std::vector ToAbsoluteSection( inline std::vector> SplitIds( const std::string& id_name, const std::vector& height_section, framework::Scope* scope) { - auto& id_tensor = scope->Var(id_name)->Get(); + auto& id_tensor = scope->FindVar(id_name)->Get(); auto* id_data = id_tensor.data(); std::set all_ids; for (size_t i = 0; i < id_tensor.numel(); ++i) { @@ -111,14 +111,15 @@ inline void MergeMultipleVarsIntoOnBySection( auto cpu_place = platform::CPUPlace(); auto abs_sections = ToAbsoluteSection(height_section); - auto& id_tensor = scope->Var(id_name)->Get(); + auto& id_tensor = scope->FindVar(id_name)->Get(); auto* id_data = id_tensor.data(); std::unordered_map> id_to_offset; for (size_t i = 0; i < id_tensor.numel(); ++i) { id_to_offset[id_data[i]].push_back(i); } - auto* out_tensor = scope->Var(out_name)->GetMutable(); + auto* out_tensor = + scope->FindVar(out_name)->GetMutable(); auto* out_tensor_data = out_tensor->mutable_data(context.GetPlace()); for (size_t section_idx = 0; section_idx < out_var_names.size(); diff --git a/paddle/fluid/operators/lookup_table_op.h b/paddle/fluid/operators/lookup_table_op.h index 4adb829f2..223de413b 100644 --- a/paddle/fluid/operators/lookup_table_op.h +++ b/paddle/fluid/operators/lookup_table_op.h @@ -56,7 +56,8 @@ class LookupTableKernel : public framework::OpKernel { context.Attr>("height_sections"); if (remote_prefetch) { -// if emap is not empty, then the paramter will be fetched from remote parameter +// if emap is not empty, then the parameter will be fetched from remote +// parameter // server #ifdef PADDLE_WITH_DISTRIBUTE operators::distributed::prefetch(id_name, out_name, table_name, epmap, -- GitLab