Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XPU] Fix delete_repeated_ops_pass, fix multiclass_nms3 #56434

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions paddle/fluid/framework/ir/delete_repeated_ops_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ void DeleteRepeatedOpsPass::DeleteRepeatedOps(
Graph* graph) {
VLOG(4) << "handle DeleteRepeatedOps";
GET_IR_NODE_FROM_SUBGRAPH(in_var, in_var, pattern);
// in_var node may be deleted by the previous detected subgraph
if (graph->Nodes().count(in_var) == 0) {
return;
}

std::vector<std::string> invalid_out_ops{
"while", "conditional_block", "fetch"};
Expand Down
12 changes: 10 additions & 2 deletions paddle/phi/kernels/xpu/multiclass_nms3_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ void MultiClassNMSKernel(const Context& ctx,
rois_num_vec.clear();
if (is_lod) {
if (has_rois_num) {
phi::DenseTensor rois_num_host;
rois_num_host.Resize(rois_num.get_ptr()->dims());
ctx.template HostAlloc<int>(&rois_num_host);
phi::Copy(ctx,
*rois_num.get_ptr(),
rois_num_host.place(),
false,
&rois_num_host);
n = rois_num.get_ptr()->numel();
for (int i = 0; i < n; i++) {
rois_num_vec.push_back(rois_num.get_ptr()->data<int>()[i]);
boxes_count += rois_num.get_ptr()->data<int>()[i];
rois_num_vec.push_back(rois_num_host.data<int>()[i]);
boxes_count += rois_num_host.data<int>()[i];
}
} else {
auto lod = bboxes.lod().back();
Expand Down