class_docstr: This layer aims to build a mapping from raw keys to indices within [0, max_index).
  The mapping is continuously built during training. The mapping will be frozen during
  evaluation and prediction. Unseen keys will be assigned to index 0.
code: def __init__(
      self,
      model,
      input_record,
      max_index,
      name="map_to_range",
      **kwargs,
  ):
      super().__init__(model, name, input_record, **kwargs)
  
      assert max_index > 0
      assert isinstance(input_record, schema.Scalar)
  
      self.max_index = max_index
  
      self.handler = self.create_param(
          param_name="handler",
          shape=[],
          initializer=(
              "LongIndexCreate",
              {"max_elements": self.max_index},
          ),
          optimizer=model.NoOptim,
      )
  
      self.output_schema = schema.Struct(
          (
              "indices",
              schema.Scalar(
                  np.int64, self.get_next_blob_reference("indices")
              ),
          ),
          ("handler", schema.Scalar(np.void, self.handler)),
      )
  
file_path: pytorch/caffe2/python/layers/build_index.py
imports: import numpy
  from caffe2.python import core, schema
  from caffe2.python.layers.layers import ModelLayer
label_desc: Use image node_id 1 to create a new MapToRange object from inherited base classes: ModelLayer with example: obj = MapToRange(model, input_record, max_index, name)