From 846cf3ed21c274f95f041e7e21fd039ca5c99a1f Mon Sep 17 00:00:00 2001 From: xiangruhuang Date: Wed, 13 Apr 2022 17:04:35 -0400 Subject: [PATCH] skip backprop in case no grouped indices are available (#926) --- pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py b/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py index 83773a39c..cd2c1f341 100644 --- a/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py +++ b/pcdet/ops/pointnet2/pointnet2_stack/pointnet2_utils.py @@ -441,10 +441,11 @@ def backward(ctx, grad_new_features: torch.Tensor, grad_local_xyz: torch.Tensor, point_cnt_of_grid, grouped_idxs, N, num_c_in = ctx.vector_pool_for_backward grad_support_features = grad_new_features.new_zeros((N, num_c_in)) - pointnet2.vector_pool_grad_wrapper( - grad_new_features.contiguous(), point_cnt_of_grid, grouped_idxs, - grad_support_features - ) + if grouped_idxs.shape[0] > 0: + pointnet2.vector_pool_grad_wrapper( + grad_new_features.contiguous(), point_cnt_of_grid, grouped_idxs, + grad_support_features + ) return None, None, grad_support_features, None, None, None, None, None, None, None, None, None, None, None, None