@@ -77,7 +77,7 @@ struct cpu_gather_scatter_functor {
77
77
const std::string& method_name,
78
78
const func_t & reduce_op,
79
79
bool include_self,
80
- const phi::DeviceContext& ctx UNUSED) {
80
+ const phi::DeviceContext& dev_ctx UNUSED) {
81
81
if (index.numel () == 0 ) {
82
82
return ;
83
83
}
@@ -237,7 +237,7 @@ void cpu_gather_kernel(phi::DenseTensor self,
237
237
const phi::DenseTensor& index,
238
238
phi::DenseTensor result,
239
239
bool include_self,
240
- const phi::DeviceContext& ctx ) {
240
+ const phi::DeviceContext& dev_ctx ) {
241
241
cpu_gather_scatter_functor<tensor_t ,
242
242
index_t ,
243
243
/* is_scatter_like=*/ false >()(result,
@@ -247,7 +247,7 @@ void cpu_gather_kernel(phi::DenseTensor self,
247
247
" gather_out_cpu" ,
248
248
tensor_assign,
249
249
include_self,
250
- ctx );
250
+ dev_ctx );
251
251
}
252
252
253
253
template <typename tensor_t , typename index_t >
@@ -256,7 +256,7 @@ void cpu_scatter_assign_kernel(phi::DenseTensor self,
256
256
const phi::DenseTensor& index,
257
257
phi::DenseTensor src,
258
258
bool include_self,
259
- const phi::DeviceContext& ctx ) {
259
+ const phi::DeviceContext& dev_ctx ) {
260
260
cpu_gather_scatter_functor<tensor_t ,
261
261
index_t ,
262
262
/* is_scatter_like=*/ true >()(self,
@@ -266,7 +266,7 @@ void cpu_scatter_assign_kernel(phi::DenseTensor self,
266
266
" scatter_assign_cpu" ,
267
267
tensor_assign,
268
268
include_self,
269
- ctx );
269
+ dev_ctx );
270
270
}
271
271
272
272
template <typename tensor_t , typename index_t >
@@ -275,11 +275,17 @@ void cpu_scatter_add_kernel(phi::DenseTensor self,
275
275
const phi::DenseTensor& index,
276
276
phi::DenseTensor src,
277
277
bool include_self,
278
- const phi::DeviceContext& ctx ) {
278
+ const phi::DeviceContext& dev_ctx ) {
279
279
cpu_gather_scatter_functor<tensor_t ,
280
280
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);
283
289
}
284
290
285
291
template <typename tensor_t , typename index_t >
@@ -288,11 +294,17 @@ void cpu_scatter_mul_kernel(phi::DenseTensor self,
288
294
const phi::DenseTensor& index,
289
295
phi::DenseTensor src,
290
296
bool include_self,
291
- const phi::DeviceContext& ctx ) {
297
+ const phi::DeviceContext& dev_ctx ) {
292
298
cpu_gather_scatter_functor<tensor_t ,
293
299
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);
296
308
}
297
309
298
310
template <typename tensor_t , typename index_t >
@@ -301,11 +313,17 @@ void cpu_scatter_mean_kernel(phi::DenseTensor self,
301
313
const phi::DenseTensor& index,
302
314
phi::DenseTensor src,
303
315
bool include_self,
304
- const phi::DeviceContext& ctx ) {
316
+ const phi::DeviceContext& dev_ctx ) {
305
317
cpu_gather_scatter_functor<tensor_t ,
306
318
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);
309
327
}
310
328
311
329
template <typename tensor_t , typename index_t >
@@ -314,11 +332,17 @@ void cpu_scatter_max_kernel(phi::DenseTensor self,
314
332
const phi::DenseTensor& index,
315
333
phi::DenseTensor src,
316
334
bool include_self,
317
- const phi::DeviceContext& ctx ) {
335
+ const phi::DeviceContext& dev_ctx ) {
318
336
cpu_gather_scatter_functor<tensor_t ,
319
337
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);
322
346
}
323
347
324
348
template <typename tensor_t , typename index_t >
@@ -327,11 +351,17 @@ void cpu_scatter_min_kernel(phi::DenseTensor self,
327
351
const phi::DenseTensor& index,
328
352
phi::DenseTensor src,
329
353
bool include_self,
330
- const phi::DeviceContext& ctx ) {
354
+ const phi::DeviceContext& dev_ctx ) {
331
355
cpu_gather_scatter_functor<tensor_t ,
332
356
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);
335
365
}
336
366
337
367
template <typename tensor_t , typename index_t >
@@ -340,7 +370,7 @@ void cpu_scatter_input_grad_kernel(phi::DenseTensor self UNUSED,
340
370
const phi::DenseTensor& index,
341
371
phi::DenseTensor grad,
342
372
bool include_self UNUSED,
343
- const phi::DeviceContext& ctx UNUSED) {
373
+ const phi::DeviceContext& dev_ctx UNUSED) {
344
374
auto * index_data = index.data <index_t >();
345
375
auto * grad_data = grad.data <tensor_t >();
346
376
@@ -376,16 +406,17 @@ void cpu_scatter_input_grad_kernel(phi::DenseTensor self UNUSED,
376
406
}
377
407
378
408
template <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) {
389
420
auto * index_data = index.data <index_t >();
390
421
auto * grad_data = grad.data <tensor_t >();
391
422
auto * out_data = out.data <tensor_t >();
@@ -457,7 +488,8 @@ void cpu_scatter_mean_input_grad_kernel(phi::DenseTensor self UNUSED,
457
488
const phi::DenseTensor& index,
458
489
phi::DenseTensor grad,
459
490
bool include_self UNUSED,
460
- const phi::DeviceContext& ctx UNUSED) {
491
+ const phi::DeviceContext& dev_ctx
492
+ UNUSED) {
461
493
auto * index_data = index.data <index_t >();
462
494
auto * grad_data = grad.data <tensor_t >();
463
495
@@ -504,7 +536,7 @@ void cpu_scatter_value_grad_kernel(phi::DenseTensor self,
504
536
const phi::DenseTensor& index,
505
537
phi::DenseTensor grad,
506
538
bool include_self UNUSED,
507
- const phi::DeviceContext& ctx UNUSED) {
539
+ const phi::DeviceContext& dev_ctx UNUSED) {
508
540
auto * self_data = self.data <tensor_t >();
509
541
auto * index_data = index.data <index_t >();
510
542
auto * grad_data = grad.data <tensor_t >();
@@ -564,7 +596,7 @@ void cpu_scatter_add_mean_value_grad_kernel(
564
596
phi::DenseTensor grad,
565
597
const std::string& reduce,
566
598
bool include_self,
567
- const phi::DeviceContext& ctx UNUSED) {
599
+ const phi::DeviceContext& dev_ctx UNUSED) {
568
600
auto * self_data = self.data <tensor_t >();
569
601
auto * index_data = index.data <index_t >();
570
602
auto * grad_data = grad.data <tensor_t >();
@@ -643,16 +675,17 @@ void cpu_scatter_add_mean_value_grad_kernel(
643
675
}
644
676
645
677
template <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) {
656
689
auto * self_data = self.data <tensor_t >();
657
690
auto * index_data = index.data <index_t >();
658
691
auto * grad_data = grad.data <tensor_t >();
0 commit comments