From ad2ab952075ac7d0ff59434b353ce5cba5d35563 Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Thu, 21 Dec 2017 12:33:34 +0800 Subject: [PATCH] "small fix of Place" (#6766) --- paddle/platform/device_context.cc | 4 ++-- paddle/platform/device_context.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/platform/device_context.cc b/paddle/platform/device_context.cc index 8cdc5f4340..dacee74fff 100644 --- a/paddle/platform/device_context.cc +++ b/paddle/platform/device_context.cc @@ -19,7 +19,7 @@ CPUDeviceContext::CPUDeviceContext() { eigen_device_.reset(new Eigen::DefaultDevice()); } -CPUDeviceContext::CPUDeviceContext(CPUPlace place) { +CPUDeviceContext::CPUDeviceContext(CPUPlace place) : place_(place) { eigen_device_.reset(new Eigen::DefaultDevice()); } @@ -27,7 +27,7 @@ Eigen::DefaultDevice* CPUDeviceContext::eigen_device() const { return eigen_device_.get(); } -Place CPUDeviceContext::GetPlace() const { return CPUPlace(); } +Place CPUDeviceContext::GetPlace() const { return place_; } #ifdef PADDLE_WITH_CUDA diff --git a/paddle/platform/device_context.h b/paddle/platform/device_context.h index 56813a1d5b..6cc0508522 100644 --- a/paddle/platform/device_context.h +++ b/paddle/platform/device_context.h @@ -45,6 +45,7 @@ class CPUDeviceContext : public DeviceContext { Place GetPlace() const override; private: + CPUPlace place_; std::unique_ptr eigen_device_; }; -- GitLab