class_docstr: Performs preprocessing for sparse features (i.e. id_list, id_score_list)
  
  Functionality includes:
  (1) changes keys from feature_id to feature_name, for better debuggability
  (2) maps sparse ids to embedding table indices based on id_mapping
  (3) filters out ids which aren't in the id2name
class_docstr_tok: ["Performs","preprocessing","for","sparse","features","(","i.e",".","id_list",",","id_score_list",")","Functionality","includes",":","(","1",")","changes","keys","from","feature_id","to","feature_name",",","for","better","debuggability","(","2",")","maps","sparse","ids","to","embedding","table","indices","based","on","id_mapping","(","3",")","filters","out","ids","which","are","n't","in","the","id2name"]
code: def __setstate__(self, state):
      # Set object attributes from pickled state dictionary
      # Notice, this method should not be scripted!
      # This method is for pickle only, which is used in Inter Process Communication (IPC)
      # , i.e., copy objects across multi-processes
  
      # Notice, we need to re-init the module so that the attributes can be assigned
      super().__init__()
      self.gen_torch_script = state["gen_torch_script"]
      if self.gen_torch_script:
          raise AssertionError(
              "SparsePreprocessor should not be scripted at this stage!"
          )
      self.id2name = cast(Dict[int, str], state["id2name"])
      self.name2id = cast(Dict[int, str], state["name2id"])
      self._id_list_mappers = state["id_list_mappers"]
      self._id_score_list_mappers = state["id_score_list_mappers"]
      self.device = state["device"]
  
      self.id_list_mappers = torch.nn.ModuleDict(
          {self.id2name[k]: v for k, v in self._id_list_mappers.items()}
      )
      self.id_score_list_mappers = torch.nn.ModuleDict(
          {
              self.id2name[k]: v
              for k, v in self._id_score_list_mappers.items()
          }
      )
  
imports: import abc
  import logging
  from typing import cast, Dict, Tuple
  import reagent.core.types
  import torch
label_desc: Use image node_id 3 for calling the SparsePreprocessor obj's underlying member method code with example usage: obj.__setstate__(state) without return types