class_docstr: Environment wrapper to convert TF environments in DM environments.
class_docstr_tok: ["Environment","wrapper","to","convert","TF","environments","in","DM","environments","."]
code: def __init__(self, env: py_environment.PyEnvironment):
      super(PyToDMWrapper, self).__init__()
      self._environment = env
      if env.batched:
          raise NotImplementedError(
              "Batched environments cannot be converted to dm environments."
          )
      self._observation_spec = tree.map_structure(
          _convert_spec, env.observation_spec()
      )
      self._action_spec = tree.map_structure(
          _convert_spec, env.action_spec()
      )
      self._discount_spec = tree.map_structure(
          _convert_spec, env.discount_spec()
      )
  
file_path: agents/tf_agents/environments/py_to_dm_wrapper.py
imports: from typing import Text
  import dm_env
  from dm_env import specs
  from tf_agents.environments import py_environment
  from tf_agents.specs import array_spec
  from tf_agents.trajectories import time_step
  import tree
label_desc: Use image node_id 1 to create a new PyToDMWrapper object from inherited base classes: dm_env with example: obj = PyToDMWrapper(env)