[Fix] Add missing contiguous calls for nms_rotated (#2547)

Addresses issue https://github.com/open-mmlab/mmcv/issues/2542

For nms_rotated_cuda only adds contiguous call to dets_sorted which is accessed directly.
For nms_rotated_cpu the implementation now matches what's in the detectron2 repo.
pull/2579/head
Allan Zelener 2023-01-31 22:44:56 -08:00 committed by GitHub
parent 87768b7f2d
commit 497c2df495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -26,8 +26,8 @@ Tensor nms_rotated(const Tensor dets, const Tensor scores, const Tensor order,
assert(dets.device().is_cuda() == scores.device().is_cuda());
if (dets.device().is_cuda()) {
#ifdef MMCV_WITH_CUDA
return nms_rotated_cuda(dets, scores, order, dets_sorted, iou_threshold,
multi_label);
return nms_rotated_cuda(dets, scores, order, dets_sorted.contiguous(),
iou_threshold, multi_label);
#else
AT_ERROR("Not compiled with GPU support");
#endif
@ -39,5 +39,5 @@ Tensor nms_rotated(const Tensor dets, const Tensor scores, const Tensor order,
#endif
}
return nms_rotated_cpu(dets, scores, iou_threshold);
return nms_rotated_cpu(dets.contiguous(), scores.contiguous(), iou_threshold);
}