code: def bpr_loss(self, users, pos, neg):
      (
          users_emb,
          pos_emb,
          neg_emb,
          userEmb0,
          posEmb0,
          negEmb0,
      ) = self.getEmbedding(
          users.astype("int32"),
          pos.astype("int32"),
          neg.astype("int32"),
      )
      reg_loss = (
          (1 / 2)
          * (
              userEmb0.norm(2).pow(2)
              + posEmb0.norm(2).pow(2)
              + negEmb0.norm(2).pow(2)
          )
          / float(len(users))
      )
      pos_scores = paddle.multiply(users_emb, pos_emb)
      pos_scores = paddle.sum(pos_scores, axis=1)
      neg_scores = paddle.multiply(users_emb, neg_emb)
      neg_scores = paddle.sum(neg_scores, axis=1)
      loss = paddle.mean(
          paddle.nn.functional.softplus(neg_scores - pos_scores)
      )
      return loss, reg_loss
  
imports: import paddle
  import paddle.nn
  from dataloader import BasicDataset
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import pgl
  from pgl.nn import functional
  from tqdm import tqdm
label_desc: Use image node_id 4 for calling the LightGCN obj's underlying member method code with example usage: obj.bpr_loss(users, pos, neg) and returns: loss,  reg_loss