Exemple #1
0
    def backward(ctx, grad_out):
        # type: (any, torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]
        r"""
        Parameters
        ----------
        grad_out : torch.Tensor
            (B, c, n) tensor with gradients of ouputs

        Returns
        -------
        grad_features : torch.Tensor
            (B, c, m) tensor with gradients of features

        None

        None
        """
        idx, weight, m = ctx.three_interpolate_for_backward
        # idx, weight, m = ctx.saved_tensors

        grad_features = _ext.three_interpolate_grad(
            grad_out.contiguous(), idx, weight, m
        )

        # return grad_features, None, None
        return grad_features, torch.zeros_like(idx), torch.zeros_like(weight)
Exemple #2
0
    def backward(ctx, grad_out):
        """
        :param ctx:
        :param grad_out: (B, C, N) tensor with gradients of outputs
        :return:
            grad_features: (B, C, M) tensor with gradients of features
            None:
            None:
        """
        idx, weight, m = ctx.three_interpolate_for_backward

        grad_features = _ext.three_interpolate_grad(grad_out.contiguous(), idx,
                                                    weight, m)

        return grad_features, None, None
    def backward(ctx, grad_out):
        # type: (Any, torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]
        r"""
        Parameters
        ----------
        grad_out : torch.Tensor
            (B, c, n) tensor with gradients of ouputs
        Returns
        -------
        grad_features : torch.Tensor
            (B, c, m) tensor with gradients of features
        None
        None
        """
        idx, weight, m = ctx.three_interpolate_for_backward

        grad_features = _ext.three_interpolate_grad(grad_out.contiguous(), idx,
                                                    weight, m)

        return grad_features, None, None