未验证 提交 a10718e8 编写于 作者: D duanyanhui 提交者: GitHub

[XPU] fix distribute_fpn_proposals (#51873)

* fix distribute_fpn_proposals

* fix bug
上级 5dda0ef6
...@@ -49,7 +49,7 @@ static void Sort(const XPUContext& dev_ctx, ...@@ -49,7 +49,7 @@ static void Sort(const XPUContext& dev_ctx,
return scores_slice_cpu_data[i] < scores_slice_cpu_data[j]; 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()}); index_out->Resize({index_t.numel()});
int* idx_out = dev_ctx.template Alloc<int>(index_out); int* idx_out = dev_ctx.template Alloc<int>(index_out);
memory_utils::Copy( memory_utils::Copy(
...@@ -108,7 +108,7 @@ void DistributeFpnProposalsKernel( ...@@ -108,7 +108,7 @@ void DistributeFpnProposalsKernel(
xpu::VectorParam<int> rois_lod = { xpu::VectorParam<int> rois_lod = {
rois_lod_vec.data(), static_cast<int>(rois_lod_vec.size()), nullptr}; rois_lod_vec.data(), static_cast<int>(rois_lod_vec.size()), nullptr};
int r = xpu::distribute_fpn_proposals_helper<XPUType, int, int>( int r = xpu::distribute_fpn_proposals_helper<XPUType, int>(
dev_ctx.x_context(), dev_ctx.x_context(),
reinterpret_cast<const XPUType*>(fpn_rois.data<T>()), reinterpret_cast<const XPUType*>(fpn_rois.data<T>()),
rois_lod, rois_lod,
...@@ -158,7 +158,7 @@ void DistributeFpnProposalsKernel( ...@@ -158,7 +158,7 @@ void DistributeFpnProposalsKernel(
fpn_rois_shape, fpn_rois_shape,
sub_idx.numel(), sub_idx.numel(),
0); 0);
PADDLE_ENFORCE_XDNN_SUCCESS(r1, "distribute_fpn_proposals_helper"); PADDLE_ENFORCE_XDNN_SUCCESS(r1, "gather");
} else { } else {
multi_fpn_rois[i]->Resize({sub_rois_num, funcs::kBoxDim}); multi_fpn_rois[i]->Resize({sub_rois_num, funcs::kBoxDim});
dev_ctx.template Alloc<T>(multi_fpn_rois[i]); dev_ctx.template Alloc<T>(multi_fpn_rois[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册