class_docstr: Implements dm_env.Environent; forwards calls to deepmind_lab.
class_docstr_tok: ["Implements","dm_env.Environent",";","forwards","calls","to","deepmind_lab","."]
code: def __init__(self, level, observation_names, config):
      self._lab = deepmind_lab.Lab(level, observation_names, config)
      self._observation_names = observation_names
      self._needs_reset = True
  
      lab_action_specs = self._lab.action_spec()
      self._action_spec = {}
      self._action_map = {}
      self._action_count = len(lab_action_specs)
      for i, spec in enumerate(lab_action_specs):
          name = spec["name"]
          self._action_map[name] = i
          self._action_spec[name] = dm_env.specs.BoundedArray(
              dtype=np.dtype("int32"),
              shape=(),
              name=name,
              minimum=spec["min"],
              maximum=spec["max"],
          )
  
      self._observation_spec = {}
      for spec in self._lab.observation_spec():
          name = spec["name"]
          shape = spec["shape"]
          if name in self._observation_names:
              if 0 in shape:
                  raise NotImplementedError(
                      "Dynamic shapes are not supported by dm_env; requested shape for "
                      "observation {} was {}.".format(name, shape)
                  )
              self._observation_spec[name] = dm_env.specs.Array(
                  dtype=spec["dtype"], shape=shape, name=name
              )
  
file_path: lab/python/dmenv_module.py
imports: import dm_env
  import numpy
  import six
  import deepmind_lab
label_desc: Use image node_id 1 to create a new Lab object from inherited base classes: dm_env with example: obj = Lab(level, observation_names, config)