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 __init__(
      self,
      id2name: Dict[int, str],
      name2id: Dict[str, int],
      id_list_mappers: Dict[int, MapIDList],
      id_score_list_mappers: Dict[int, MapIDScoreList],
      device: torch.device,
      gen_torch_script: bool,
  ) -> None:
      super().__init__()
      assert set(id2name.keys()) == set(id_list_mappers.keys()) | set(
          id_score_list_mappers.keys()
      )
      self._id2name: Dict[int, str] = id2name
      self._name2id: Dict[str, int] = name2id
      if gen_torch_script:
          # pyre-fixme[8]: Attribute has type `Dict[int, str]`; used as `Attribute`.
          self.id2name: Dict[int, str] = torch.jit.Attribute(
              id2name, Dict[int, str]
          )
          # pyre-fixme[8]: Attribute has type `Dict[str, int]`; used as `Attribute`.
          self.name2id: Dict[str, int] = torch.jit.Attribute(
              name2id, Dict[str, int]
          )
      else:
          self.id2name: Dict[int, str] = id2name
          self.name2id: Dict[str, int] = name2id
      self._id_list_mappers = id_list_mappers
      self._id_score_list_mappers = id_score_list_mappers
      self.id_list_mappers = torch.nn.ModuleDict(
          {id2name[k]: v for k, v in id_list_mappers.items()}
      )
      self.id_score_list_mappers = torch.nn.ModuleDict(
          {id2name[k]: v for k, v in id_score_list_mappers.items()}
      )
  
      self.device = device
      self.gen_torch_script = gen_torch_script
  
imports: import abc
  import logging
  from typing import cast, Dict, Tuple
  import reagent.core.types
  import torch
label_desc: Use image node_id 1 to create a new SparsePreprocessor object from inherited base classes: torch.nn with example: obj = SparsePreprocessor(id2name, name2id, id_list_mappers, id_score_list_mappers, device, gen_torch_script)