class_docstr: Negative sampling based skip-gram
class_docstr_tok: ["Negative","sampling","based","skip-gram"]
docstr: get grad for positve samples
docstr_tok: ["get","grad","for","positve","samples"]
code: def fast_pos_bp(self, emb_pos_u, emb_pos_v, first_flag):
      """get grad for positve samples"""
      pos_score = torch.sum(torch.mul(emb_pos_u, emb_pos_v), dim=1)
      pos_score = torch.clamp(pos_score, max=6, min=-6)
      # [batch_size, 1]
      score = (1 - self.fast_sigmoid(pos_score)).unsqueeze(1)
      if self.record_loss:
          if first_flag:
              self.loss_fst.append(
                  torch.mean(self.fast_logsigmoid(pos_score)).item()
              )
          else:
              self.loss_snd.append(
                  torch.mean(self.fast_logsigmoid(pos_score)).item()
              )
  
      # [batch_size, dim]
      if self.lap_norm > 0:
          grad_u_pos = score * emb_pos_v + self.lap_norm * (
              emb_pos_v - emb_pos_u
          )
          grad_v_pos = score * emb_pos_u + self.lap_norm * (
              emb_pos_u - emb_pos_v
          )
      else:
          grad_u_pos = score * emb_pos_v
          grad_v_pos = score * emb_pos_u
  
      return grad_u_pos, grad_v_pos
  
imports: import random
  import numpy
  import torch
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  from torch.multiprocessing import Queue
  from torch.nn import init
label_desc: Use image node_id 9 for calling the SkipGramModel obj's underlying member method code with example usage: obj.fast_pos_bp(emb_pos_u, emb_pos_v, first_flag) and returns: grad_u_pos,  grad_v_pos