code: def update(self, mem, momentum, ind, time, interp=False):
      if self.num_gpus > 1:
          mem, ind, time = du.all_gather([mem, ind, time])
      with torch.no_grad():
          if interp:
              t0 = time.floor().long()  # - 1
              t0 = torch.clamp(t0, 0, self.memory.shape[1] - 1)
              t1 = t0 + 1
              t1 = torch.clamp(t1, 0, self.memory.shape[1] - 1)
              mem_t0 = self.memory[ind.view(-1), t0.view(-1), :]
              mem_t1 = self.memory[ind.view(-1), t1.view(-1), :]
              w2 = time.float().view(-1, 1) / float(self.duration)
              w_t1 = (time - t0).view(-1, 1).float()
              w_t1 = 1 - w_t1  # hack for inverse
  
              w_t0 = 1 - w_t1
              # mem = mem.squeeze()
              duo_update = False
              if duo_update:
                  update_t0 = (
                      mem * w_t0 + mem_t0 * w_t1
                  ) * momentum + mem_t0 * (1 - momentum)
                  update_t1 = (
                      mem * w_t1 + mem_t1 * w_t0
                  ) * momentum + mem_t1 * (1 - momentum)
              else:
                  update_t0 = mem * w_t0 * momentum + mem_t0 * (
                      1 - momentum
                  )
                  update_t1 = mem * w_t1 * momentum + mem_t1 * (
                      1 - momentum
                  )
  
              update_t0 = self.l2_norm(update_t0)
              update_t1 = self.l2_norm(update_t1)
  
              self.memory[
                  ind.view(-1), t0.view(-1), :
              ] = update_t0.squeeze()
              self.memory[
                  ind.view(-1), t1.view(-1), :
              ] = update_t1.squeeze()
          else:
              mem = mem.view(mem.size(0), 1, -1)
              mem_old = self.get(ind, time, interp=interp)
              mem_update = mem * momentum + mem_old * (1 - momentum)
              mem_update = self.l2_norm2d(mem_update)
              # logger.info("1dmem set ind shape {} time shape {}".format(ind.shape, time.shape))
  
              # my version
              self.memory[
                  ind.view(-1), time.long().view(-1), :
              ] = mem_update.squeeze()
              return
  
imports: import math
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import slowfast.models.losses
  import slowfast.utils.distributed
  import slowfast.utils.logging
  from slowfast.models.video_model_builder import X3D, MViT, ResNet, SlowFast
  from .build import MODEL_REGISTRY
label_desc: Use image node_id 4 for calling the Memory obj's underlying member method code with example usage: obj.update(mem, momentum, ind, time, interp) without return types