@@ -77,7 +77,7 @@ struct cpu_gather_scatter_functor {
7777 const std::string& method_name,
7878 const func_t & reduce_op,
7979 bool include_self,
80- const phi::DeviceContext& ctx UNUSED) {
80+ const phi::DeviceContext& dev_ctx UNUSED) {
8181 if (index.numel () == 0 ) {
8282 return ;
8383 }
@@ -237,7 +237,7 @@ void cpu_gather_kernel(phi::DenseTensor self,
237237 const phi::DenseTensor& index,
238238 phi::DenseTensor result,
239239 bool include_self,
240- const phi::DeviceContext& ctx ) {
240+ const phi::DeviceContext& dev_ctx ) {
241241 cpu_gather_scatter_functor<tensor_t ,
242242 index_t ,
243243 /* is_scatter_like=*/ false >()(result,
@@ -247,7 +247,7 @@ void cpu_gather_kernel(phi::DenseTensor self,
247247 " gather_out_cpu" ,
248248 tensor_assign,
249249 include_self,
250- ctx );
250+ dev_ctx );
251251}
252252
253253template <typename tensor_t , typename index_t >
@@ -256,7 +256,7 @@ void cpu_scatter_assign_kernel(phi::DenseTensor self,
256256 const phi::DenseTensor& index,
257257 phi::DenseTensor src,
258258 bool include_self,
259- const phi::DeviceContext& ctx ) {
259+ const phi::DeviceContext& dev_ctx ) {
260260 cpu_gather_scatter_functor<tensor_t ,
261261 index_t ,
262262 /* is_scatter_like=*/ true >()(self,
@@ -266,7 +266,7 @@ void cpu_scatter_assign_kernel(phi::DenseTensor self,
266266 " scatter_assign_cpu" ,
267267 tensor_assign,
268268 include_self,
269- ctx );
269+ dev_ctx );
270270}
271271
272272template <typename tensor_t , typename index_t >
@@ -275,11 +275,17 @@ void cpu_scatter_add_kernel(phi::DenseTensor self,
275275 const phi::DenseTensor& index,
276276 phi::DenseTensor src,
277277 bool include_self,
278- const phi::DeviceContext& ctx ) {
278+ const phi::DeviceContext& dev_ctx ) {
279279 cpu_gather_scatter_functor<tensor_t ,
280280 index_t ,
281- /* is_scatter_like=*/ true >()(
282- self, dim, index, src, " scatter_add_cpu" , reduce_add, include_self, ctx);
281+ /* is_scatter_like=*/ true >()(self,
282+ dim,
283+ index,
284+ src,
285+ " scatter_add_cpu" ,
286+ reduce_add,
287+ include_self,
288+ dev_ctx);
283289}
284290
285291template <typename tensor_t , typename index_t >
@@ -288,11 +294,17 @@ void cpu_scatter_mul_kernel(phi::DenseTensor self,
288294 const phi::DenseTensor& index,
289295 phi::DenseTensor src,
290296 bool include_self,
291- const phi::DeviceContext& ctx ) {
297+ const phi::DeviceContext& dev_ctx ) {
292298 cpu_gather_scatter_functor<tensor_t ,
293299 index_t ,
294- /* is_scatter_like=*/ true >()(
295- self, dim, index, src, " scatter_mul_cpu" , reduce_mul, include_self, ctx);
300+ /* is_scatter_like=*/ true >()(self,
301+ dim,
302+ index,
303+ src,
304+ " scatter_mul_cpu" ,
305+ reduce_mul,
306+ include_self,
307+ dev_ctx);
296308}
297309
298310template <typename tensor_t , typename index_t >
@@ -301,11 +313,17 @@ void cpu_scatter_mean_kernel(phi::DenseTensor self,
301313 const phi::DenseTensor& index,
302314 phi::DenseTensor src,
303315 bool include_self,
304- const phi::DeviceContext& ctx ) {
316+ const phi::DeviceContext& dev_ctx ) {
305317 cpu_gather_scatter_functor<tensor_t ,
306318 index_t ,
307- /* is_scatter_like=*/ true >()(
308- self, dim, index, src, " scatter_mean_cpu" , reduce_add, include_self, ctx);
319+ /* is_scatter_like=*/ true >()(self,
320+ dim,
321+ index,
322+ src,
323+ " scatter_mean_cpu" ,
324+ reduce_add,
325+ include_self,
326+ dev_ctx);
309327}
310328
311329template <typename tensor_t , typename index_t >
@@ -314,11 +332,17 @@ void cpu_scatter_max_kernel(phi::DenseTensor self,
314332 const phi::DenseTensor& index,
315333 phi::DenseTensor src,
316334 bool include_self,
317- const phi::DeviceContext& ctx ) {
335+ const phi::DeviceContext& dev_ctx ) {
318336 cpu_gather_scatter_functor<tensor_t ,
319337 index_t ,
320- /* is_scatter_like=*/ true >()(
321- self, dim, index, src, " scatter_max_cpu" , reduce_max, include_self, ctx);
338+ /* is_scatter_like=*/ true >()(self,
339+ dim,
340+ index,
341+ src,
342+ " scatter_max_cpu" ,
343+ reduce_max,
344+ include_self,
345+ dev_ctx);
322346}
323347
324348template <typename tensor_t , typename index_t >
@@ -327,11 +351,17 @@ void cpu_scatter_min_kernel(phi::DenseTensor self,
327351 const phi::DenseTensor& index,
328352 phi::DenseTensor src,
329353 bool include_self,
330- const phi::DeviceContext& ctx ) {
354+ const phi::DeviceContext& dev_ctx ) {
331355 cpu_gather_scatter_functor<tensor_t ,
332356 index_t ,
333- /* is_scatter_like=*/ true >()(
334- self, dim, index, src, " scatter_min_cpu" , reduce_min, include_self, ctx);
357+ /* is_scatter_like=*/ true >()(self,
358+ dim,
359+ index,
360+ src,
361+ " scatter_min_cpu" ,
362+ reduce_min,
363+ include_self,
364+ dev_ctx);
335365}
336366
337367template <typename tensor_t , typename index_t >
@@ -340,7 +370,7 @@ void cpu_scatter_input_grad_kernel(phi::DenseTensor self UNUSED,
340370 const phi::DenseTensor& index,
341371 phi::DenseTensor grad,
342372 bool include_self UNUSED,
343- const phi::DeviceContext& ctx UNUSED) {
373+ const phi::DeviceContext& dev_ctx UNUSED) {
344374 auto * index_data = index.data <index_t >();
345375 auto * grad_data = grad.data <tensor_t >();
346376
@@ -376,16 +406,17 @@ void cpu_scatter_input_grad_kernel(phi::DenseTensor self UNUSED,
376406}
377407
378408template <typename tensor_t , typename index_t >
379- void cpu_scatter_mul_min_max_input_grad_kernel (phi::DenseTensor self UNUSED,
380- int dim,
381- const phi::DenseTensor& index,
382- const phi::DenseTensor& out,
383- const phi::DenseTensor& x,
384- const phi::DenseTensor& value,
385- phi::DenseTensor grad,
386- const std::string& reduce,
387- bool include_self UNUSED,
388- const phi::DeviceContext& ctx) {
409+ void cpu_scatter_mul_min_max_input_grad_kernel (
410+ phi::DenseTensor self UNUSED,
411+ int dim,
412+ const phi::DenseTensor& index,
413+ const phi::DenseTensor& out,
414+ const phi::DenseTensor& x,
415+ const phi::DenseTensor& value,
416+ phi::DenseTensor grad,
417+ const std::string& reduce,
418+ bool include_self UNUSED,
419+ const phi::DeviceContext& dev_ctx) {
389420 auto * index_data = index.data <index_t >();
390421 auto * grad_data = grad.data <tensor_t >();
391422 auto * out_data = out.data <tensor_t >();
@@ -457,7 +488,8 @@ void cpu_scatter_mean_input_grad_kernel(phi::DenseTensor self UNUSED,
457488 const phi::DenseTensor& index,
458489 phi::DenseTensor grad,
459490 bool include_self UNUSED,
460- const phi::DeviceContext& ctx UNUSED) {
491+ const phi::DeviceContext& dev_ctx
492+ UNUSED) {
461493 auto * index_data = index.data <index_t >();
462494 auto * grad_data = grad.data <tensor_t >();
463495
@@ -504,7 +536,7 @@ void cpu_scatter_value_grad_kernel(phi::DenseTensor self,
504536 const phi::DenseTensor& index,
505537 phi::DenseTensor grad,
506538 bool include_self UNUSED,
507- const phi::DeviceContext& ctx UNUSED) {
539+ const phi::DeviceContext& dev_ctx UNUSED) {
508540 auto * self_data = self.data <tensor_t >();
509541 auto * index_data = index.data <index_t >();
510542 auto * grad_data = grad.data <tensor_t >();
@@ -564,7 +596,7 @@ void cpu_scatter_add_mean_value_grad_kernel(
564596 phi::DenseTensor grad,
565597 const std::string& reduce,
566598 bool include_self,
567- const phi::DeviceContext& ctx UNUSED) {
599+ const phi::DeviceContext& dev_ctx UNUSED) {
568600 auto * self_data = self.data <tensor_t >();
569601 auto * index_data = index.data <index_t >();
570602 auto * grad_data = grad.data <tensor_t >();
@@ -643,16 +675,17 @@ void cpu_scatter_add_mean_value_grad_kernel(
643675}
644676
645677template <typename tensor_t , typename index_t >
646- void cpu_scatter_mul_min_max_value_grad_kernel (phi::DenseTensor self,
647- int dim,
648- const phi::DenseTensor& index,
649- const phi::DenseTensor& out,
650- const phi::DenseTensor& x,
651- const phi::DenseTensor& value,
652- phi::DenseTensor grad,
653- const std::string& reduce,
654- bool include_self,
655- const phi::DeviceContext& ctx) {
678+ void cpu_scatter_mul_min_max_value_grad_kernel (
679+ phi::DenseTensor self,
680+ int dim,
681+ const phi::DenseTensor& index,
682+ const phi::DenseTensor& out,
683+ const phi::DenseTensor& x,
684+ const phi::DenseTensor& value,
685+ phi::DenseTensor grad,
686+ const std::string& reduce,
687+ bool include_self,
688+ const phi::DeviceContext& dev_ctx) {
656689 auto * self_data = self.data <tensor_t >();
657690 auto * index_data = index.data <index_t >();
658691 auto * grad_data = grad.data <tensor_t >();
0 commit comments