class_docstr: Serializer for gym.spaces.Box.
  
  Assumes that the space is bounded. Internally rescales it to the [0, 1]
  interval and uses a fixed-precision encoding.
class_docstr_tok: ["Serializer","for","gym.spaces.Box",".","Assumes","that","the","space","is","bounded",".","Internally","rescales","it","to","the","[","0",",","1","]","interval","and","uses","a","fixed-precision","encoding","."]
code: def __init__(
      self, space, vocab_size, precision=2, max_range=(-100.0, 100.0)
  ):
      self._precision = precision
  
      # Some gym envs (e.g. CartPole) have unreasonably high bounds for
      # observations. We clip so we can represent them.
      bounded_space = copy.copy(space)
      (min_low, max_high) = max_range
      bounded_space.low = np.maximum(space.low, min_low)
      bounded_space.high = np.minimum(space.high, max_high)
      if not np.allclose(
          bounded_space.low, space.low
      ) or not np.allclose(bounded_space.high, space.high):
          logging.warning(
              "Space limits %s, %s out of bounds %s. Clipping to %s, %s.",
              str(space.low),
              str(space.high),
              str(max_range),
              str(bounded_space.low),
              str(bounded_space.high),
          )
  
      super().__init__(bounded_space, vocab_size)
  
imports: import copy
  from absl import logging
  import gin
  import gym
  from jax import numpy
label_desc: Use image node_id 1 to create a new BoxSpaceSerializer object from inherited base classes: SpaceSerializer with example: obj = BoxSpaceSerializer(space, vocab_size, precision, max_range)