class_docstr: The LightGCN model from the `"LightGCN: Simplifying and Powering
  Graph Convolution Network for Recommendation"
  <https://arxiv.org/abs/2002.02126>`_ paper.
  
  :class:`~torch_geometric.nn.models.LightGCN` learns embeddings by linearly
  propagating them on the underlying graph, and uses the weighted sum of the
  embeddings learned at all layers as the final embedding
  
  .. math::
      \textbf{x}_i = \sum_{l=0}^{L} \alpha_l \textbf{x}^{(l)}_i,
  
  where each layer's embedding is computed as
  
  .. math::
      \mathbf{x}^{(l+1)}_i = \sum_{j \in \mathcal{N}(i)}
      \frac{1}{\sqrt{\deg(i)\deg(j)}}\mathbf{x}^{(l)}_j.
  
  Two prediction heads and training objectives are provided:
  **link prediction** (via
  :meth:`~torch_geometric.nn.models.LightGCN.link_pred_loss` and
  :meth:`~torch_geometric.nn.models.LightGCN.predict_link`) and
  **recommendation** (via
  :meth:`~torch_geometric.nn.models.LightGCN.recommendation_loss` and
  :meth:`~torch_geometric.nn.models.LightGCN.recommend`).
  
  .. note::
  
      Embeddings are propagated according to the graph connectivity specified
      by :obj:`edge_index` while rankings or link probabilities are computed
      according to the edges specified by :obj:`edge_label_index`.
  
  .. note::
  
      For an example of using :class:`LightGCN`, see `examples/lightgcn.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      lightgcn.py>`_.
  
  Args:
      num_nodes (int): The number of nodes in the graph.
      embedding_dim (int): The dimensionality of node embeddings.
      num_layers (int): The number of
          :class:`~torch_geometric.nn.conv.LGConv` layers.
      alpha (float or torch.Tensor, optional): The scalar or vector
          specifying the re-weighting coefficients for aggregating the final
          embedding. If set to :obj:`None`, the uniform initialization of
          :obj:`1 / (num_layers + 1)` is used. (default: :obj:`None`)
      **kwargs (optional): Additional arguments of the underlying
          :class:`~torch_geometric.nn.conv.LGConv` layers.
docstr: Get top-:math:`k` recommendations for nodes in :obj:`src_index`.
  
  Args:
      edge_index (torch.Tensor or SparseTensor): Edge tensor specifying
          the connectivity of the graph.
      edge_weight (torch.Tensor, optional): The weight of each edge in
          :obj:`edge_index`. (default: :obj:`None`)
      src_index (torch.Tensor, optional): Node indices for which
          recommendations should be generated.
          If set to :obj:`None`, all nodes will be used.
          (default: :obj:`None`)
      dst_index (torch.Tensor, optional): Node indices which represent
          the possible recommendation choices.
          If set to :obj:`None`, all nodes will be used.
          (default: :obj:`None`)
      k (int, optional): Number of recommendations. (default: :obj:`1`)
      sorted (bool, optional): Whether to sort the recommendations
          by score. (default: :obj:`True`)
docstr_tok: ["Get","top-",":","math",":","`","k","`","recommendations","for","nodes","in",":","obj",":","`","src_index","`",".","Args",":","edge_index","(","torch.Tensor","or","SparseTensor",")",":","Edge","tensor","specifying","the","connectivity","of","the","graph",".","edge_weight","(","torch.Tensor",",","optional",")",":","The","weight","of","each","edge","in",":","obj",":","`","edge_index","`",".","(","default",":",":","obj",":","`","None","`",")","src_index","(","torch.Tensor",",","optional",")",":","Node","indices","for","which","recommendations","should","be","generated",".","If","set","to",":","obj",":","`","None","`",",","all","nodes","will","be","used",".","(","default",":",":","obj",":","`","None","`",")","dst_index","(","torch.Tensor",",","optional",")",":","Node","indices","which","represent","the","possible","recommendation","choices",".","If","set","to",":","obj",":","`","None","`",",","all","nodes","will","be","used",".","(","default",":",":","obj",":","`","None","`",")","k","(","int",",","optional",")",":","Number","of","recommendations",".","(","default",":",":","obj",":","`","1","`",")","sorted","(","bool",",","optional",")",":","Whether","to","sort","the","recommendations","by","score",".","(","default",":",":","obj",":","`","True","`",")"]
code: def recommend(
      self,
      edge_index: Adj,
      edge_weight: OptTensor = None,
      src_index: OptTensor = None,
      dst_index: OptTensor = None,
      k: int = 1,
      sorted: bool = True,
  ) -> Tensor:
      r"""Get top-:math:`k` recommendations for nodes in :obj:`src_index`.
  
      Args:
          edge_index (torch.Tensor or SparseTensor): Edge tensor specifying
              the connectivity of the graph.
          edge_weight (torch.Tensor, optional): The weight of each edge in
              :obj:`edge_index`. (default: :obj:`None`)
          src_index (torch.Tensor, optional): Node indices for which
              recommendations should be generated.
              If set to :obj:`None`, all nodes will be used.
              (default: :obj:`None`)
          dst_index (torch.Tensor, optional): Node indices which represent
              the possible recommendation choices.
              If set to :obj:`None`, all nodes will be used.
              (default: :obj:`None`)
          k (int, optional): Number of recommendations. (default: :obj:`1`)
          sorted (bool, optional): Whether to sort the recommendations
              by score. (default: :obj:`True`)
      """
      out_src = out_dst = self.get_embedding(edge_index, edge_weight)
  
      if src_index is not None:
          out_src = out_src[src_index]
  
      if dst_index is not None:
          out_dst = out_dst[dst_index]
  
      pred = out_src @ out_dst.t()
      top_index = pred.topk(k, dim=-1, sorted=sorted).indices
  
      if (
          dst_index is not None
      ):  # Map local top-indices to original indices.
          top_index = dst_index[top_index.view(-1)].view(
              *top_index.size()
          )
  
      return top_index
  
imports: from typing import Optional, Union
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.nn import Embedding, ModuleList
  from torch.nn.modules.loss import _Loss
  from torch_geometric.nn.conv import LGConv
  from torch_geometric.typing import Adj, OptTensor
  from torch_geometric.utils import is_sparse, to_edge_index
label_desc: Use image node_id 6 for calling the LightGCN obj's underlying member method code with example usage: obj.recommend(edge_index, edge_weight, src_index, dst_index, k, sorted) and returns: top_index