class_docstr: Convert a RangeParameter of type int to a ordered ChoiceParameter.
  
  Transform is done in-place.
class_docstr_tok: ["Convert","a","RangeParameter","of","type","int","to","a","ordered","ChoiceParameter",".","Transform","is","done","in-place","."]
code: def _transform_search_space(
      self, search_space: SearchSpace
  ) -> SearchSpace:
      transformed_parameters: Dict[str, Parameter] = {}
      for p_name, p in search_space.parameters.items():
          if (
              p_name in self.transform_parameters
              and isinstance(p, RangeParameter)
              and p.parameter_type == ParameterType.INT
              and p.upper - p.lower + 1 <= self.max_choices
          ):
              values = list(range(p.lower, p.upper + 1))  # pyre-ignore
              target_value = (
                  None
                  if p.target_value is None
                  else next(
                      i
                      for i, v in enumerate(values)
                      if v == p.target_value
                  )
              )
              transformed_parameters[p_name] = ChoiceParameter(
                  name=p_name,
                  parameter_type=p.parameter_type,
                  values=values,  # pyre-fixme[6]
                  is_ordered=True,
                  is_fidelity=p.is_fidelity,
                  target_value=target_value,
              )
          else:
              transformed_parameters[p.name] = p
      return construct_new_search_space(
          search_space=search_space,
          parameters=list(transformed_parameters.values()),
          parameter_constraints=[
              pc.clone_with_transformed_parameters(
                  transformed_parameters=transformed_parameters
              )
              for pc in search_space.parameter_constraints
          ],
      )
  
file_path: Ax/ax/modelbridge/transforms/int_range_to_choice.py
imports: from typing import Dict, List, Optional, Set, TYPE_CHECKING
  from ax.core.observation import Observation
  from ax.core.parameter import ChoiceParameter, Parameter, ParameterType, RangeParameter
  from ax.core.search_space import SearchSpace
  from ax.modelbridge.transforms.base import Transform
  from ax.modelbridge.transforms.utils import construct_new_search_space
  from ax.models.types import TConfig
label_desc: Use image node_id 2 for calling the IntRangeToChoice obj's underlying member method code with example usage: obj._transform_search_space(search_space) and returns: construct_new_search_space