From a10718e8484b0757a8fd860270b82986483eacba Mon Sep 17 00:00:00 2001 From: duanyanhui <45005871+YanhuiDua@users.noreply.github.com> Date: Wed, 22 Mar 2023 18:42:58 +0800 Subject: [PATCH] [XPU] fix distribute_fpn_proposals (#51873) * fix distribute_fpn_proposals * fix bug --- paddle/phi/kernels/xpu/distribute_fpn_proposals_kernel.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/phi/kernels/xpu/distribute_fpn_proposals_kernel.cc b/paddle/phi/kernels/xpu/distribute_fpn_proposals_kernel.cc index e78a501b6a4..f72a3c87486 100644 --- a/paddle/phi/kernels/xpu/distribute_fpn_proposals_kernel.cc +++ b/paddle/phi/kernels/xpu/distribute_fpn_proposals_kernel.cc @@ -49,7 +49,7 @@ static void Sort(const XPUContext& dev_ctx, return scores_slice_cpu_data[i] < scores_slice_cpu_data[j]; }; - std::sort(index, index + value.numel(), compare); + std::stable_sort(index, index + value.numel(), compare); index_out->Resize({index_t.numel()}); int* idx_out = dev_ctx.template Alloc(index_out); memory_utils::Copy( @@ -108,7 +108,7 @@ void DistributeFpnProposalsKernel( xpu::VectorParam rois_lod = { rois_lod_vec.data(), static_cast(rois_lod_vec.size()), nullptr}; - int r = xpu::distribute_fpn_proposals_helper( + int r = xpu::distribute_fpn_proposals_helper( dev_ctx.x_context(), reinterpret_cast(fpn_rois.data()), rois_lod, @@ -158,7 +158,7 @@ void DistributeFpnProposalsKernel( fpn_rois_shape, sub_idx.numel(), 0); - PADDLE_ENFORCE_XDNN_SUCCESS(r1, "distribute_fpn_proposals_helper"); + PADDLE_ENFORCE_XDNN_SUCCESS(r1, "gather"); } else { multi_fpn_rois[i]->Resize({sub_rois_num, funcs::kBoxDim}); dev_ctx.template Alloc(multi_fpn_rois[i]); -- GitLab