code: def forward(self, feed_dict):
      src_embed = self.embedding(feed_dict["src"])
      pos_embed = self.embedding(feed_dict["pos"])
  
      # batch neg sample
      batch_size = feed_dict["pos"].shape[0]
      neg_idx = paddle.randint(
          low=0, high=batch_size, shape=[batch_size, self.neg_num]
      )
      negs = []
      for i in range(self.neg_num):
          tmp = paddle.gather(pos_embed, neg_idx[:, i])
          tmp = paddle.reshape(tmp, [-1, 1, self.embed_size])
          negs.append(tmp)
  
      neg_embed = paddle.concat(negs, axis=1)
      src_embed = paddle.reshape(src_embed, [-1, 1, self.embed_size])
      pos_embed = paddle.reshape(pos_embed, [-1, 1, self.embed_size])
  
      # [batch_size, 1, 1]
      pos_logits = paddle.matmul(src_embed, pos_embed, transpose_y=True)
      # [batch_size, 1, neg_num]
      neg_logits = paddle.matmul(src_embed, neg_embed, transpose_y=True)
  
      ones_label = paddle.ones_like(pos_logits)
      pos_loss = self.loss_fn(pos_logits, ones_label)
  
      zeros_label = paddle.zeros_like(neg_logits)
      neg_loss = self.loss_fn(neg_logits, zeros_label)
  
      loss = (pos_loss + neg_loss) / 2
      return loss
  
file_path: PGL/examples/metapath2vec/model.py
imports: import math
  import time
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling the SkipGramModel obj's underlying member method code with example usage: obj.forward(feed_dict) and returns: loss