code: def __call__(self, user_feat, pos_item_feat, neg_item_feat):
      pos = L.reduce_sum(
          user_feat * pos_item_feat, -1, keep_dim=True
      )  # [B, 1]
      all_pos = all_gather(pos)  # [B * n, 1]
      all_neg_item_feat = all_gather(neg_item_feat)  # [B * n, 1]
      all_user_feat = all_gather(user_feat)  # [B * n, 1]
  
      neg1 = L.matmul(
          user_feat, all_neg_item_feat, transpose_y=True
      )  # [B, B * n]
      neg2 = L.matmul(
          all_user_feat, neg_item_feat, transpose_y=True
      )  # [B *n, B]
  
      loss1 = L.reduce_mean(L.relu(neg1 - pos + self.config.margin))
      loss2 = L.reduce_mean(L.relu(neg2 - all_pos + self.config.margin))
  
      loss = loss1 + loss2
      return loss
  
file_path: PGL/legacy/examples/erniesage/models/loss.py
imports: import time
  import glob
  import os
  import numpy
  import pgl
  import paddle.fluid
  import paddle.fluid.layers
label_desc: Use image node_id 1 for calling the GlobalHingeLoss obj's underlying member method code with example usage: obj.__call__(user_feat, pos_item_feat, neg_item_feat) and returns: loss