Пример #1
0
    def forward(ctx, features: torch.Tensor,
                idx: torch.Tensor) -> torch.Tensor:
        r"""

        Parameters
        ----------
        features : torch.Tensor
            (B, C, N) tensor of points to group
        idx : torch.Tensor
            (B, npoint, nsample) tensor containing the indicies of points to group with

        Returns
        -------
        torch.Tensor
            (B, C, npoint, nsample) tensor
        """
        assert features.is_contiguous()
        assert idx.is_contiguous()

        B, nfeatures, nsample = idx.size()
        _, C, N = features.size()

        #output = torch.cuda.FloatTensor(B, C, nfeatures, nsample)

        #pointnet2.group_points_wrapper(
        #    B, C, N, nfeatures, nsample, features, idx, output
        #)

        ctx.for_backwards = (idx, N)
        return _ext.group_points(features, idx)
Пример #2
0
    def forward(ctx, features, idx):
        # type: (Any, torch.Tensor, torch.Tensor) -> torch.Tensor
        r"""

        Parameters
        ----------
        features : torch.Tensor
            (B, C, N) tensor of features to group
        idx : torch.Tensor
            (B, npoint, nsample) tensor containing the indicies of features to group with

        Returns
        -------
        torch.Tensor
            (B, C, npoint, nsample) tensor
        """
        ctx.save_for_backward(idx, features)

        return _ext.group_points(features, idx)
 def forward(ctx, features, idx):
     B, nfeatures, nsample = idx.size()
     _, C, N = features.size()
     ctx.for_backwards = (idx, N)
     return _ext.group_points(features, idx)