def forward(ctx, xyz: torch.Tensor, npoint: int) -> torch.Tensor: """ Uses iterative furthest point sampling to select a set of npoint features that have the largest minimum distance :param ctx: :param xyz: (B, N, 3) where N > npoint :param npoint: int, number of features in the sampled set :return: output: (B, npoint) tensor containing the set """ assert xyz.is_contiguous() B, N, _ = xyz.size() output = torch.cuda.IntTensor(B, npoint) temp = torch.cuda.FloatTensor(B, N).fill_(1e10) pointnet2.furthest_point_sampling_wrapper(B, N, npoint, xyz, temp, output) return output
def forward(ctx, points_xyz: torch.Tensor, num_points: int) -> torch.Tensor: """forward. Args: points_xyz (Tensor): (B, N, 3) where N > num_points. num_points (int): Number of points in the sampled set. Returns: Tensor: (B, num_points) indices of the sampled points. """ assert points_xyz.is_contiguous() B, N, _ = points_xyz.size() output = torch.cuda.IntTensor(B, num_points) temp = torch.cuda.FloatTensor(B, N).fill_(1e10) pointnet2.furthest_point_sampling_wrapper(B, N, num_points, points_xyz, temp, output) ctx.mark_non_differentiable(output) return output