From d0b13abfc7f73a91bb103f354cd89837d49467a2 Mon Sep 17 00:00:00 2001 From: Hong Ming Date: Wed, 12 Jun 2019 03:37:53 +0000 Subject: [PATCH] enable conv_winograd, fix conv_gemmlike bug, and update the unit tests of conv op test=develop --- paddle/fluid/lite/core/memory.h | 2 ++ paddle/fluid/lite/utils/any.h | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/lite/core/memory.h b/paddle/fluid/lite/core/memory.h index 5948f6c4a8..6b019abc19 100644 --- a/paddle/fluid/lite/core/memory.h +++ b/paddle/fluid/lite/core/memory.h @@ -65,6 +65,8 @@ class Buffer { TargetCopy(target_, data_, other.data_, nbytes); } + ~Buffer() { Free(); } + private: // memory it actually malloced. size_t space_{0}; diff --git a/paddle/fluid/lite/utils/any.h b/paddle/fluid/lite/utils/any.h index 466deae3de..33e697a6da 100644 --- a/paddle/fluid/lite/utils/any.h +++ b/paddle/fluid/lite/utils/any.h @@ -34,7 +34,6 @@ class Any { CHECK(type_ == typeid(T).hash_code()); } else { type_ = typeid(T).hash_code(); - data_ = new T; deleter_ = [&] { delete static_cast(data_); }; } data_ = new T; @@ -55,10 +54,16 @@ class Any { bool valid() const { return data_; } + ~Any() { + if (valid()) { + deleter_(); + } + } + private: static size_t kInvalidType; size_t type_{kInvalidType}; - void* data_{}; + void* data_{nullptr}; std::function deleter_; }; -- GitLab