diff --git a/mmdet3d/models/data_preprocessors/data_preprocessor.py b/mmdet3d/models/data_preprocessors/data_preprocessor.py index 05c8452a0c..afca17e3dd 100644 --- a/mmdet3d/models/data_preprocessors/data_preprocessor.py +++ b/mmdet3d/models/data_preprocessors/data_preprocessor.py @@ -434,12 +434,12 @@ def voxelize(self, points: List[Tensor], res_coors_numpy = res_coors.cpu().numpy() inds, point2voxel_map = self.sparse_quantize( res_coors_numpy, return_index=True, return_inverse=True) - point2voxel_map = torch.from_numpy(point2voxel_map).cuda() + point2voxel_map = torch.from_numpy(point2voxel_map).to(res.device) if self.training and self.max_voxels is not None: if len(inds) > self.max_voxels: inds = np.random.choice( inds, self.max_voxels, replace=False) - inds = torch.from_numpy(inds).cuda() + inds = torch.from_numpy(inds).to(res.device) if hasattr(data_sample.gt_pts_seg, 'pts_semantic_mask'): data_sample.gt_pts_seg.voxel_semantic_mask \ = data_sample.gt_pts_seg.pts_semantic_mask[inds]