code: def async_update(num_threads, model, queue):
      """asynchronous embedding update"""
      torch.set_num_threads(num_threads)
      while True:
          (grad_u, grad_v, grad_v_neg, nodes, neg_nodes) = queue.get()
          if grad_u is None:
              return
          with torch.no_grad():
              model.u_embeddings.weight.data.index_add_(
                  0, nodes.view(-1), grad_u
              )
              model.v_embeddings.weight.data.index_add_(
                  0, nodes.view(-1), grad_v
              )
              if neg_nodes is not None:
                  model.v_embeddings.weight.data.index_add_(
                      0, neg_nodes.view(-1), grad_v_neg
                  )
  
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 6 for calling a global function with example usage: async_update(num_threads, model, queue) without return types