code: def async_update(self, queue, event):
      """Update embeddings asynchronously"""
      set_current_device_id()
      weight = None
      _moment = None
  
      while True:
          (index, grad_trace) = queue.get()
          if index is None:
              return
          if weight is None:
              # Must reload in here, the mmap obj can't pass with spawn.
              weight = np.load(
                  self._weight_path, allow_pickle=True, mmap_mode="r+"
              )
              _moment = np.load(self._moment_path, mmap_mode="r+")
  
          index = index.clone()
          grad_trace = [x.clone() for x in grad_trace]
          event.set()  # Release the main thread.
  
          # Copy tensor to numpy.
          grad, grad_square = grad_trace
          index = index.numpy()
          grad = grad.numpy()
          grad_square = grad_square.numpy()
  
          # update adagrad
          _moment[index] += grad_square
          std = np.sqrt(_moment[index]) + 1e-10
          grad = -self._lr * grad / std.reshape((-1, 1))
          weight[index] += grad
  
imports: import os
  import time
  import numpy
  import paddle
  import paddle.distributed
label_desc: Use image node_id 3 for calling a global function with example usage: async_update(queue, event) without return types