diff --git a/paddle/operators/math/selected_rows_functor.cu b/paddle/operators/math/selected_rows_functor.cu index a406bef39ad5f71b1eaccc28e9ef5b09d2e6b59b..ea149ebbc12beeab43a2047372352ba769959307 100644 --- a/paddle/operators/math/selected_rows_functor.cu +++ b/paddle/operators/math/selected_rows_functor.cu @@ -89,7 +89,7 @@ __global__ void SelectedRowsAddTensorKernel(const T* selected_rows, // Since index in rows of SelectedRows can be duplicate, we can not use // tensor_out[index] += selected_rows[index]; Instead, we have to use // AtomicAdd to avoid concurrent write error. - paddle::platform::CudaAtomicAdd(&tensor_out[index], selected_rows[index]); + paddle::platform::CudaAtomicAdd(tensor_out + index, selected_rows[index]); } } } // namespace @@ -121,7 +121,7 @@ struct SelectedRowsAddTensor { int block_size = 256; dim3 threads(block_size, 1); - dim3 grid(1, in1_height); + dim3 grid(1, in1_rows.size()); SelectedRowsAddTensorKernel< T><<(context)