def forward(ctx, features: torch.Tensor, idx: torch.Tensor) -> torch.Tensor: r""" Parameters ---------- features : torch.Tensor (B, C, N) tensor idx : torch.Tensor (B, npoint) tensor of the features to gather Returns ------- torch.Tensor (B, C, npoint) tensor """ assert features.is_contiguous() assert idx.is_contiguous() B, npoint = idx.size() _, C, N = features.size() #output = torch.cuda.FloatTensor(B, C, npoint) #pointnet2.gather_points_wrapper( # B, C, N, npoint, features, idx, output #) ctx.for_backwards = (idx, C, N) #return output return _ext.gather_points(features, idx)
def forward(ctx, features, idx): # type: (Any, torch.Tensor, torch.Tensor) -> torch.Tensor r""" Parameters ---------- features : torch.Tensor (B, C, N) tensor idx : torch.Tensor (B, npoint) tensor of the features to gather Returns ------- torch.Tensor (B, C, npoint) tensor """ ctx.save_for_backward(idx, features) return _ext.gather_points(features, idx)