class_docstr: The Bayesian Personalized Ranking (BPR) loss.
  
  The BPR loss is a pairwise loss that encourages the prediction of an
  observed entry to be higher than its unobserved counterparts
  (see `here <https://arxiv.org/abs/2002.02126>`__).
  
  .. math::
      L_{\text{BPR}} = - \sum_{u=1}^{M} \sum_{i \in \mathcal{N}_u}
      \sum_{j \not\in \mathcal{N}_u} \ln \sigma(\hat{y}_{ui} - \hat{y}_{uj})
      + \lambda \vert\vert \textbf{x}^{(0)} \vert\vert^2
  
  where :math:`lambda` controls the :math:`L_2` regularization strength.
  We compute the mean BPR loss for simplicity.
  
  Args:
      lambda_reg (float, optional): The :math:`L_2` regularization strength
          (default: 0).
      **kwargs (optional): Additional arguments of the underlying
          :class:`torch.nn.modules.loss._Loss` class.
docstr: Compute the mean Bayesian Personalized Ranking (BPR) loss.
  
  .. note::
  
      The i-th entry in the :obj:`positives` vector and i-th entry
      in the :obj:`negatives` entry should correspond to the same
      entity (*.e.g*, user), as the BPR is a personalized ranking loss.
  
  Args:
      positives (Tensor): The vector of positive-pair rankings.
      negatives (Tensor): The vector of negative-pair rankings.
      parameters (Tensor, optional): The tensor of parameters which
          should be used for :math:`L_2` regularization
          (default: :obj:`None`).
docstr_tok: ["Compute","the","mean","Bayesian","Personalized","Ranking","(","BPR",")","loss",".","..","note",":",":","The","i-th","entry","in","the",":","obj",":","`","positives","`","vector","and","i-th","entry","in","the",":","obj",":","`","negatives","`","entry","should","correspond","to","the","same","entity","(","*",".e.g","*",",","user",")",",","as","the","BPR","is","a","personalized","ranking","loss",".","Args",":","positives","(","Tensor",")",":","The","vector","of","positive-pair","rankings",".","negatives","(","Tensor",")",":","The","vector","of","negative-pair","rankings",".","parameters","(","Tensor",",","optional",")",":","The","tensor","of","parameters","which","should","be","used","for",":","math",":","`","L_2","`","regularization","(","default",":",":","obj",":","`","None","`",")","."]
code: def forward(
      self,
      positives: Tensor,
      negatives: Tensor,
      parameters: Tensor = None,
  ) -> Tensor:
      r"""Compute the mean Bayesian Personalized Ranking (BPR) loss.
  
      .. note::
  
          The i-th entry in the :obj:`positives` vector and i-th entry
          in the :obj:`negatives` entry should correspond to the same
          entity (*.e.g*, user), as the BPR is a personalized ranking loss.
  
      Args:
          positives (Tensor): The vector of positive-pair rankings.
          negatives (Tensor): The vector of negative-pair rankings.
          parameters (Tensor, optional): The tensor of parameters which
              should be used for :math:`L_2` regularization
              (default: :obj:`None`).
      """
      log_prob = F.logsigmoid(positives - negatives).mean()
  
      regularization = 0
      if self.lambda_reg != 0:
          regularization = self.lambda_reg * parameters.norm(p=2).pow(2)
          regularization = regularization / positives.size(0)
  
      return -log_prob + regularization
  
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 2 for calling the BPRLoss obj's underlying member method code with example usage: obj.forward(positives, negatives, parameters) and returns: unknown