class_docstr: One-hot preprocessor for Discrete and MultiDiscrete spaces.
  
  .. testcode::
      :skipif: True
  
      self.transform(Discrete(3).sample())
  
  .. testoutput::
  
      np.array([0.0, 1.0, 0.0])
  
  .. testcode::
      :skipif: True
  
      self.transform(MultiDiscrete([2, 3]).sample())
  
  .. testoutput::
  
      np.array([0.0, 1.0, 0.0, 0.0, 1.0])
code: def transform(self, observation: TensorType) -> np.ndarray:
      self.check_shape(observation)
      return gym.spaces.utils.flatten(
          self._obs_space, observation
      ).astype(np.float32)
  
imports: from collections import OrderedDict
  import logging
  import numpy
  import gymnasium
  from typing import Any, List
  from ray.rllib.utils.annotations import override, PublicAPI, DeveloperAPI
  from ray.rllib.utils.spaces.repeated import Repeated
  from ray.rllib.utils.typing import TensorType
  from ray.rllib.utils.images import resize
  from ray.rllib.utils.spaces.space_utils import convert_element_to_space_type
label_desc: Use image node_id 2 for calling the OneHotPreprocessor obj's underlying member method code with example usage: obj.transform(observation) and returns: gym