diff --git a/paddle/operators/tensor.save b/paddle/operators/tensor.save deleted file mode 100644 index de6cd5a66a26e9e8f2bee245cf17ec190c5c1e05..0000000000000000000000000000000000000000 Binary files a/paddle/operators/tensor.save and /dev/null differ diff --git a/paddle/platform/device_context.cc b/paddle/platform/device_context.cc index 9d72569f51ac4b1ae722fcced8e0fada849974f0..b38ba560b75991fe9646f42aa28e6509616e31d3 100644 --- a/paddle/platform/device_context.cc +++ b/paddle/platform/device_context.cc @@ -189,11 +189,11 @@ void MKLDNNDeviceContext::AddElement(const std::string& op_key, if (GetElement(op_key)) { return; } - GetElementPool().emplace(op_key, value); + GetElementPool().emplace(op_key, std::move(value)); } template -const T MKLDNNDeviceContext::GetElement(const std::string& op_key) const { +const T& MKLDNNDeviceContext::GetElement(const std::string& op_key) const { auto it = GetElementPool().find(op_key); return it == GetElementPool().end() ? nullptr : it->second; } diff --git a/paddle/platform/device_context.h b/paddle/platform/device_context.h index 44f3ac1d3929aafa39693d588b27f527e829d0f9..21a5ed1835a3ff96187c2ef884a3c3da7ac990fb 100644 --- a/paddle/platform/device_context.h +++ b/paddle/platform/device_context.h @@ -132,7 +132,7 @@ class MKLDNNDeviceContext : public CPUDeviceContext { /* \brief Get existed element: memory, primitive or primitive desc */ template - const T GetElement(const std::string& op_key) const; + const T& GetElement(const std::string& op_key) const; /* \brief Get element pool: memory, primitive or primitive desc pool */ template @@ -140,7 +140,7 @@ class MKLDNNDeviceContext : public CPUDeviceContext { GetElementPool() const; /* \brief Get the active engine */ - const MKLDNNEnginePtr GetEngine() const { return engine_; } + const MKLDNNEngine& engine() const { return *engine_; } /* \brief Submit primitive to pipeline */ void Submit(const MKLDNNPrimitivePtr& p) { pipeline_.push_back(*p); } @@ -163,7 +163,7 @@ class MKLDNNDeviceContext : public CPUDeviceContext { std::hash> primitive_desc_pool_; std::vector pipeline_; - std::unique_ptr stream_; + MKLDNNStreamPtr stream_; MKLDNNEnginePtr engine_; bool ready_; }; diff --git a/paddle/platform/mkldnn_helper.h b/paddle/platform/mkldnn_helper.h index 07a9c362c573eb6b3b7bc02efd3afab6692f273b..cd52a8b4c434071a030a8e7a8a70fc3adba8460c 100644 --- a/paddle/platform/mkldnn_helper.h +++ b/paddle/platform/mkldnn_helper.h @@ -25,10 +25,11 @@ using MKLDNNMemory = mkldnn::memory; using MKLDNNPrimitive = mkldnn::primitive; using MKLDNNPrimitiveDesc = mkldnn::handle; -typedef std::shared_ptr MKLDNNEnginePtr; -typedef std::shared_ptr MKLDNNMemoryPtr; -typedef std::shared_ptr MKLDNNPrimitivePtr; -typedef std::shared_ptr MKLDNNPrimitiveDescPtr; +typedef std::unique_ptr MKLDNNStreamPtr; +typedef std::unique_ptr MKLDNNEnginePtr; +typedef std::unique_ptr MKLDNNMemoryPtr; +typedef std::unique_ptr MKLDNNPrimitivePtr; +typedef std::unique_ptr MKLDNNPrimitiveDescPtr; } // namespace platform } // namespace paddle