From 1b8fe70e482f38941921759492f0c8ec76e29d6a Mon Sep 17 00:00:00 2001 From: Zhang Ting <709968123@qq.com> Date: Thu, 9 Apr 2020 13:22:13 +0800 Subject: [PATCH] fix VLOG, test=develop (#23327) --- paddle/fluid/framework/operator.cc | 2 +- paddle/fluid/framework/operator.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 87eda38902..a53e8ec09a 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -177,7 +177,7 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) { RunImpl(scope, place); } - VLOG(3) << place << " " << DebugStringEx(&scope); + VLOG(3) << GetExecutionPlace(place) << " " << DebugStringEx(&scope); } catch (platform::EnforceNotMet& exception) { framework::InsertCallStackInfo(Type(), Attrs(), &exception); throw std::move(exception); diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 470a107001..81ee2ab220 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -192,6 +192,11 @@ class OperatorBase { const platform::Place& place, const RuntimeContext& ctx) const {} + virtual platform::Place GetExecutionPlace( + const platform::Place& place) const { + return place; + } + protected: std::string type_; // NOTE: in case of OpGrad, inputs_ contains: @@ -479,6 +484,11 @@ class OperatorWithKernel : public OperatorBase { const std::string& var_name, const Tensor& tensor, const OpKernelType& expected_kernel_type) const; + virtual platform::Place GetExecutionPlace( + const platform::Place& platform) const { + return kernel_type_->place_; + } + private: void ParseInputDataType(const ExecutionContext& ctx, const std::string& name, proto::VarType::Type* type) const; -- GitLab