class_docstr: Base class for Gym space serializers.
  
  Attrs:
    space_type: (type) Gym space class that this SpaceSerializer corresponds
      to. Should be defined in subclasses.
    representation_length: (int) Number of symbols in the representation of
      every element of the space.
    significance_map: (np.ndarray) Integer array of the same size as the
      discrete representation, where elements describe the significance of
      symbols, e.g. in fixed-precision encoding. 0 is the most significant
      symbol, 1 the second most significant etc.
class_docstr_tok: ["Base","class","for","Gym","space","serializers",".","Attrs",":","space_type",":","(","type",")","Gym","space","class","that","this","SpaceSerializer","corresponds","to",".","Should","be","defined","in","subclasses",".","representation_length",":","(","int",")","Number","of","symbols","in","the","representation","of","every","element","of","the","space",".","significance_map",":","(","np.ndarray",")","Integer","array","of","the","same","size","as","the","discrete","representation",",","where","elements","describe","the","significance","of","symbols",",","e.g",".","in","fixed-precision","encoding",".","0","is","the","most","significant","symbol",",","1","the","second","most","significant","etc","."]
docstr: Creates a SpaceSerializer.
  
  Subclasses should retain the signature.
  
  Args:
    space: (gym.Space) Gym space of type self.space_type.
    vocab_size: (int) Number of symbols in the vocabulary.
docstr_tok: ["Creates","a","SpaceSerializer",".","Subclasses","should","retain","the","signature",".","Args",":","space",":","(","gym.Space",")","Gym","space","of","type","self.space_type",".","vocab_size",":","(","int",")","Number","of","symbols","in","the","vocabulary","."]
code: def __init__(self, space, vocab_size):
      """Creates a SpaceSerializer.
  
      Subclasses should retain the signature.
  
      Args:
        space: (gym.Space) Gym space of type self.space_type.
        vocab_size: (int) Number of symbols in the vocabulary.
      """
      assert isinstance(space, self.space_type)
      self._space = space
      self._vocab_size = 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 SpaceSerializer object  with example: obj = SpaceSerializer(space, vocab_size)