diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index 99e6af20bd8ea045be1207861d861bc6563cd994..c59e5508a46f4a37aa17d0a00c4c4ee05350de4d 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -25,6 +25,7 @@ #include "paddle/fluid/memory/allocation/stat_allocator.h" #include "paddle/fluid/platform/enforce.h" #include "paddle/fluid/platform/place.h" +#include "paddle/phi/core/macros.h" #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) #include @@ -493,8 +494,8 @@ class AllocatorFacadePrivate { const AllocatorMap& GetAllocatorMap() { return allocators_; } void InitNaiveBestFitCPUAllocator() { - allocators_[platform::CPUPlace()] = - std::make_shared(platform::CPUPlace()); + // It is more efficient to use CPUAllocator directly. + allocators_[platform::CPUPlace()] = std::make_shared(); } #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) @@ -1197,6 +1198,10 @@ void AllocatorFacade::RemoveMemoryPoolOfCUDAGraph(int64_t id) { } #endif #endif + +UNUSED static std::shared_ptr unused_obj = + std::make_shared(platform::CPUPlace()); + } // namespace allocation } // namespace memory } // namespace paddle diff --git a/paddle/phi/common/data_type.h b/paddle/phi/common/data_type.h index d66c6d89fe66e5cc981e20fafe009e7e8345beb2..6cbf0f50d8f28ba5d9c4e692563607e9b2efad0b 100644 --- a/paddle/phi/common/data_type.h +++ b/paddle/phi/common/data_type.h @@ -98,7 +98,7 @@ inline size_t SizeOf(DataType data_type) { case DataType::COMPLEX128: return 16; case DataType::PSTRING: - return 24; + return 48; case DataType::UNDEFINED: return 0; case DataType::NUM_DATA_TYPES: diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_yolov3.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_yolov3.py index 0da45601ea4afc8114fee79c7608a9bb659eed01..d8e766839160665884bf9b6858657c2002a642de 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_yolov3.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_yolov3.py @@ -56,8 +56,8 @@ class FakeDataReader: img = np.random.normal( 0.485, 0.229, [3, cfg.input_size, cfg.input_size] ) - point1 = cfg.input_size / 4 - point2 = cfg.input_size / 2 + point1 = 1 / 4 + point2 = 1 / 2 gt_boxes = np.array([[point1, point1, point2, point2]]) gt_labels = np.random.randint( low=0, high=cfg.class_num, size=[1]