@@ -84,7 +84,7 @@ void XPUTensorAddFunctor(const platform::Place& place,
8484 phi::DenseTensor* dst) {
8585 using XPUType = typename XPUTypeTrait<T>::Type;
8686 platform::XPUDeviceContext* ctx = dynamic_cast <platform::XPUDeviceContext*>(
87- platform ::DeviceContextPool::Instance ().Get (place));
87+ phi ::DeviceContextPool::Instance ().Get (place));
8888 const XPUType* x = reinterpret_cast <const XPUType*>(src.data <T>());
8989 XPUType* y = reinterpret_cast <XPUType*>(dst->mutable_data <T>(place));
9090 int r = -1 ;
@@ -201,8 +201,8 @@ void TensorAdd(const VarType& src, VarType* dst) {
201201 // check requiring input dtypes to be the same have been removed.
202202#define PADDLE_TENSOR_ADD (T, CONTEXT ) \
203203 if (data_type == framework::DataTypeTrait<T>::DataType ()) { \
204- auto cpu_ctx = static_cast <CONTEXT*>( \
205- platform ::DeviceContextPool::Instance ().Get (place)); \
204+ auto cpu_ctx = \
205+ static_cast <CONTEXT*>( phi ::DeviceContextPool::Instance ().Get (place)); \
206206 phi::AddKernel<T, CONTEXT>(*cpu_ctx, *dst_tensor, src_tensor, dst_tensor); \
207207 return ; \
208208 }
@@ -218,13 +218,13 @@ void TensorAdd(const VarType& src, VarType* dst) {
218218#endif
219219 }
220220
221- #define TENSOR_ADD_EIGEN (T ) \
222- auto cpu_ctx = static_cast <phi::CPUContext*>( \
223- platform ::DeviceContextPool::Instance ().Get (place)); \
224- auto in = phi::EigenVector<T>::Flatten (src_tensor); \
225- auto out = phi::EigenVector<T>::Flatten (*dst_tensor); \
226- auto & p = *(cpu_ctx->eigen_device ()); \
227- out.device (p) = out + in; \
221+ #define TENSOR_ADD_EIGEN (T ) \
222+ auto cpu_ctx = static_cast <phi::CPUContext*>( \
223+ phi ::DeviceContextPool::Instance ().Get (place)); \
224+ auto in = phi::EigenVector<T>::Flatten (src_tensor); \
225+ auto out = phi::EigenVector<T>::Flatten (*dst_tensor); \
226+ auto & p = *(cpu_ctx->eigen_device ()); \
227+ out.device (p) = out + in; \
228228 return ;
229229
230230 if (phi::is_cpu_place (place)) {
@@ -244,7 +244,7 @@ void TensorAdd(const VarType& src, VarType* dst) {
244244 if (data_type == framework::DataTypeTrait<T>::DataType ()) { \
245245 platform::CustomDeviceContext* ctx = \
246246 static_cast <platform::CustomDeviceContext*>( \
247- platform ::DeviceContextPool::Instance ().Get (place)); \
247+ phi ::DeviceContextPool::Instance ().Get (place)); \
248248 phi::stream::Stream stream (place, ctx->stream ()); \
249249 auto device = phi::DeviceManager::GetDeviceWithPlace (place); \
250250 device->BlasAXPBY <T>(stream, \
@@ -313,7 +313,7 @@ void SelectedRowsAddToTensor(const VarType& src, VarType* dst) {
313313 auto place = dst_tensor->place ();
314314 auto data_type =
315315 framework::TransToProtoVarType (src_selected_rows.value ().dtype ());
316- platform ::DeviceContextPool& pool = platform ::DeviceContextPool::Instance ();
316+ phi ::DeviceContextPool& pool = phi ::DeviceContextPool::Instance ();
317317
318318#define PADDLE_SELECTED_ROWS_ADD_TO_TENSOR (dev_ctx_type, cpp_type ) \
319319 if (data_type == framework::DataTypeTrait<cpp_type>::DataType ()) { \
@@ -363,7 +363,7 @@ void SelectedRowsAddTensor(const VarType& src_selected_rows_var,
363363
364364 const auto & place = src_tensor.place ();
365365 auto data_type = framework::TransToProtoVarType (src_tensor.dtype ());
366- auto * dev_ctx = platform ::DeviceContextPool::Instance ().Get (place);
366+ auto * dev_ctx = phi ::DeviceContextPool::Instance ().Get (place);
367367
368368 phi::DenseTensor* dst_tensor =
369369 GetInnerMutableTensor<phi::DenseTensor>(dst_tensor_var);
@@ -426,7 +426,7 @@ std::shared_ptr<ReturnVarType> SelectedRowsMerge(const VarType& src1,
426426 auto place = src_selected_rows1.value ().place ();
427427 auto data_type =
428428 framework::TransToProtoVarType (src_selected_rows1.value ().dtype ());
429- platform ::DeviceContextPool& pool = platform ::DeviceContextPool::Instance ();
429+ phi ::DeviceContextPool& pool = phi ::DeviceContextPool::Instance ();
430430
431431 std::vector<const phi::SelectedRows*> src_selected_rows;
432432 src_selected_rows.emplace_back (&src_selected_rows1);
@@ -667,7 +667,7 @@ void EagerGradientAccumulator::SumGrad(std::shared_ptr<VariableWrapper> var,
667667 if (!dst_var->Var ().IsInitialized () ||
668668 !dst_var->Var ().Get <phi::DenseTensor>().IsInitialized ()) {
669669 VLOG (6 ) << " Set StopGradient Grad: " << dst_var->Name () << " as zero " ;
670- auto * dev_ctx = platform ::DeviceContextPool::Instance ().Get (place);
670+ auto * dev_ctx = phi ::DeviceContextPool::Instance ().Get (place);
671671 if (!dst_var->Var ().IsInitialized ()) {
672672 auto * tensor = dst_var->MutableVar ()->GetMutable <phi::DenseTensor>();
673673 VLOG (6 ) << " Dims of " << dst_var->Name ()
@@ -807,7 +807,7 @@ void SortedGradientAccumulator::SumGrad(std::shared_ptr<VariableWrapper> var,
807807 if (!dst_var->Var ().IsInitialized () ||
808808 !dst_var->Var ().Get <phi::DenseTensor>().IsInitialized ()) {
809809 VLOG (6 ) << " Set StopGradient Grad: " << var->Name () << " as zero" ;
810- auto * dev_ctx = platform ::DeviceContextPool::Instance ().Get (place);
810+ auto * dev_ctx = phi ::DeviceContextPool::Instance ().Get (place);
811811 if (!dst_var->Var ().IsInitialized ()) {
812812 auto * tensor = dst_var->MutableVar ()->GetMutable <phi::DenseTensor>();
813813 VLOG (6 ) << " Dims of " << dst_var->Name ()
0 commit comments