def forward(
        self,
        x,
        algorithm="bruteforce-blas",
        dist="euclidean",
        exclude_self=False,
    ):
        r"""

        Forward computation.

        Parameters
        ----------
        x : Tensor
            :math:`(M, D)` or :math:`(N, M, D)` where :math:`N` means the
            number of point sets, :math:`M` means the number of points in
            each point set, and :math:`D` means the size of features.
        algorithm : str, optional
            Algorithm used to compute the k-nearest neighbors.

            * 'bruteforce-blas' will first compute the distance matrix
              using BLAS matrix multiplication operation provided by
              backend frameworks. Then use topk algorithm to get
              k-nearest neighbors. This method is fast when the point
              set is small but has :math:`O(N^2)` memory complexity where
              :math:`N` is the number of points.

            * 'bruteforce' will compute distances pair by pair and
              directly select the k-nearest neighbors during distance
              computation. This method is slower than 'bruteforce-blas'
              but has less memory overhead (i.e., :math:`O(Nk)` where :math:`N`
              is the number of points, :math:`k` is the number of nearest
              neighbors per node) since we do not need to store all distances.

            * 'bruteforce-sharemem' (CUDA only) is similar to 'bruteforce'
              but use shared memory in CUDA devices for buffer. This method is
              faster than 'bruteforce' when the dimension of input points
              is not large. This method is only available on CUDA device.

            * 'kd-tree' will use the kd-tree algorithm (CPU only).
              This method is suitable for low-dimensional data (e.g. 3D
              point clouds)

            * 'nn-descent' is a approximate approach from paper
              `Efficient k-nearest neighbor graph construction for generic similarity
              measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method
              will search for nearest neighbor candidates in "neighbors' neighbors".

            (default: 'bruteforce-blas')
        dist : str, optional
            The distance metric used to compute distance between points. It can be the following
            metrics:
            * 'euclidean': Use Euclidean distance (L2 norm)
              :math:`\sqrt{\sum_{i} (x_{i} - y_{i})^{2}}`.
            * 'cosine': Use cosine distance.
            (default: 'euclidean')
        exclude_self : bool, optional
            If True, the output graph will not contain self loop edges, and each node will not
            be counted as one of its own k neighbors.  If False, the output graph will contain
            self loop edges, and a node will be counted as one of its own k neighbors.

        Returns
        -------
        DGLGraph
            A DGLGraph without features.
        """
        return knn_graph(
            x, self.k, algorithm=algorithm, dist=dist, exclude_self=exclude_self
        )


        Forward computation.

        Parameters
        ----------
        x : Tensor
            :math:`(M, D)` or :math:`(N, M, D)` where :math:`N` means the
            number of point sets, :math:`M` means the number of points in
            each point set, and :math:`D` means the size of features.
        algorithm : str, optional
            Algorithm used to compute the k-nearest neighbors.

            * 'bruteforce-blas' will first compute the distance matrix
              using BLAS matrix multiplication operation provided by
              backend frameworks. Then use topk algorithm to get
              k-nearest neighbors. This method is fast when the point
              set is small but has :math:`O(N^2)` memory complexity where
              :math:`N` is the number of points.

            * 'bruteforce' will compute distances pair by pair and
              directly select the k-nearest neighbors during distance
              computation. This method is slower than 'bruteforce-blas'
              but has less memory overhead (i.e., :math:`O(Nk)` where :math:`N`
              is the number of points, :math:`k` is the number of nearest
              neighbors per node) since we do not need to store all distances.

            * 'bruteforce-sharemem' (CUDA only) is similar to 'bruteforce'
              but use shared memory in CUDA devices for buffer. This method is
              faster than 'bruteforce' when the dimension of input points
              is not large. This method is only available on CUDA device.

            * 'kd-tree' will use the kd-tree algorithm (CPU only).
              This method is suitable for low-dimensional data (e.g. 3D
              point clouds)

            * 'nn-descent' is a approximate approach from paper
              `Efficient k-nearest neighbor graph construction for generic similarity
              measures <https://www.cs.princeton.edu/cass/papers/www11.pdf>`_. This method
              will search for nearest neighbor candidates in "neighbors' neighbors".

            (default: 'bruteforce-blas')
        dist : str, optional
            The distance metric used to compute distance between points. It can be the following
            metrics:
            * 'euclidean': Use Euclidean distance (L2 norm)
              :math:`\sqrt{\sum_{i} (x_{i} - y_{i})^{2}}`.
            * 'cosine': Use cosine distance.
            (default: 'euclidean')
        exclude_self : bool, optional
            If True, the output graph will not contain self loop edges, and each node will not
            be counted as one of its own k neighbors.  If False, the output graph will contain
            self loop edges, and a node will be counted as one of its own k neighbors.

        Returns
        -------
        DGLGraph
            A DGLGraph without features.
        
python/dgl/nn/pytorch/factory.py