code: def transform(self, global_ids: torch.Tensor):
      global_id_list = global_ids.flatten().tolist()
      cache_id_list = [0] * len(global_id_list)
      for i in range(len(global_id_list)):
          gid = global_id_list[i]
          if gid in self.dict:
              cid = self.dict[gid]
          else:
              cid = len(self.dict)
              self.dict[gid] = cid
              if len(self.dict) >= self._num_embedding:
                  self.overflow = True
          cache_id_list[i] = cid
      cache_ids = torch.tensor(cache_id_list, dtype=torch.long)
      return cache_ids
  
file_path: torchrec/contrib/dynamic_embedding/tests/test_id_transformer.py
imports: import unittest
  import torch
  from torchrec_dynamic_embedding.id_transformer import IDTransformer
  from torchrec_dynamic_embedding.tensor_list import TensorList
label_desc: Use image node_id 2 for calling the PythonIdTransformer obj's underlying member method code with example usage: obj.transform(global_ids) and returns: cache_ids