code: def init_weight(walk_length, window_size, batch_size):
      """init context weight"""
      weight = []
      for b in range(batch_size):
          for i in range(walk_length):
              for j in range(i - window_size, i):
                  if j >= 0:
                      weight.append(
                          1.0 - float(i - j - 1) / float(window_size)
                      )
              for j in range(i + 1, i + 1 + window_size):
                  if j < walk_length:
                      weight.append(
                          1.0 - float(j - i - 1) / float(window_size)
                      )
  
      # [num_pos * batch_size]
      return torch.Tensor(weight).unsqueeze(1)
  
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 3 for calling a global function with example usage: init_weight(walk_length, window_size, batch_size) and returns: torch