MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / mutable_data

Method mutable_data

paddle/phi/api/lib/tensor.cc:197–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195
196template <typename T>
197T *Tensor::mutable_data() {
198 LOG_FIRST_N(WARNING, 1)
199 << "Allocating memory through `mutable_data` method is "
200 "deprecated since version 2.3, and `mutable_data` method "
201 "will be removed in version 2.4! Please use "
202 "`paddle::empty/full` method to create a new "
203 "Tensor with allocated memory, and use data<T>() method "
204 "to get the memory pointer of tensor instead. "
205 "Reason: When calling `mutable_data` to allocate memory, "
206 "the place, datatype, and data layout of tensor may be in "
207 "an illegal state.";
208 if (is_dense_tensor()) {
209 return static_cast<phi::DenseTensor *>(impl_.get())
210 ->mutable_data<T>(place());
211 }
212 return nullptr;
213}
214
215template PADDLE_API bool *Tensor::mutable_data<bool>();
216template PADDLE_API int8_t *Tensor::mutable_data<int8_t>();

Callers 8

AcquireDstMemoryMethod · 0.45
SaveSerialDataFunction · 0.45
TESTFunction · 0.45
GroupConcatSplitFunction · 0.45
TESTFunction · 0.45
InitTensorHolderFunction · 0.45
InitTensorHolderFunction · 0.45
InitTensorHolderMethod · 0.45

Calls 2

placeFunction · 0.50
getMethod · 0.45

Tested by 6

TESTFunction · 0.36
GroupConcatSplitFunction · 0.36
TESTFunction · 0.36
InitTensorHolderFunction · 0.36
InitTensorHolderFunction · 0.36
InitTensorHolderMethod · 0.36