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.
code: def __init__(self, lambda_reg: float = 0, **kwargs):
      super().__init__(None, None, "sum", **kwargs)
      self.lambda_reg = lambda_reg
  
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 1 to create a new BPRLoss object from inherited base classes: _Loss with example: obj = BPRLoss(lambda_reg)