class_docstr: A historical embedding storage module.
code: def push(
      self,
      x,
      n_id: Optional[Tensor] = None,
      offset: Optional[Tensor] = None,
      count: Optional[Tensor] = None,
  ):
      if n_id is None and x.size(0) != self.num_embeddings:
          raise ValueError
  
      elif n_id is None and x.size(0) == self.num_embeddings:
          self.emb.copy_(x)
  
      elif offset is None or count is None:
          assert n_id.device == self.emb.device
          self.emb[n_id] = x.to(self.emb.device)
  
      else:  # Push in chunks:
          src_o = 0
          x = x.to(self.emb.device)
          for (
              dst_o,
              c,
          ) in zip(offset.tolist(), count.tolist()):
              self.emb[dst_o : dst_o + c] = x[src_o : src_o + c]
              src_o += c
  
file_path: DIG/dig/lsgraph/method/GraphFMOB/history.py
imports: from typing import Optional
  import torch
  from torch import Tensor
label_desc: Use image node_id 5 for calling the History obj's underlying member method code with example usage: obj.push(x, n_id, offset, count) without return types