From 48dbae4ad4496b0415069bf6159b9f9cc6dec1a7 Mon Sep 17 00:00:00 2001 From: Allan Zelener Date: Tue, 31 Jan 2023 22:44:56 -0800 Subject: [PATCH] [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. --- mmcv/ops/csrc/pytorch/nms_rotated.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmcv/ops/csrc/pytorch/nms_rotated.cpp b/mmcv/ops/csrc/pytorch/nms_rotated.cpp index ed669169a3..b07ed5aa11 100644 --- a/mmcv/ops/csrc/pytorch/nms_rotated.cpp +++ b/mmcv/ops/csrc/pytorch/nms_rotated.cpp @@ -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); }