Skip to content

Commit e0628ff

Browse files
committed
Fix
1 parent 3ec069c commit e0628ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

paddle/phi/core/framework/tensor_util.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <vector>
2424

2525
#include "paddle/phi/api/lib/data_transform.h"
26+
#include "paddle/phi/backends/context_pool.h"
2627
#include "paddle/phi/core/framework/convert_utils.h"
2728
#include "paddle/phi/core/tensor_utils.h"
2829

@@ -157,7 +158,9 @@ struct DeserializedDataFunctor {
157158

158159
template <typename T>
159160
void apply() {
160-
*buf_ = tensor_->mutable_data<T>(place_);
161+
auto& pool = phi::DeviceContextPool::Instance();
162+
auto* dev_ctx = pool.Get(place_);
163+
*buf_ = dev_ctx->Alloc<T>(tensor_);
161164
}
162165

163166
void** buf_;

0 commit comments

Comments
 (0)