# tf_agents.environments.suite_gym.load

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/environments/suite_gym.py#L44-L97) |

Loads the selected environment and wraps it with the specified wrappers.

    tf_agents.environments.suite_gym.load(
        environment_name: Text,
        discount: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Float = 1.0,
        max_episode_steps: Optional[types.Int] = None,
        gym_env_wrappers: Sequence[https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/GymEnvWrapper] = (),
        env_wrappers: Sequence[https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/PyEnvWrapper] = (),
        spec_dtype_map: Optional[Dict[gym.Space, np.dtype]] = None,
        gym_kwargs: Optional[Dict[str, Any]] = None,
        render_kwargs: Optional[Dict[str, Any]] = None
    ) -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/PyEnvironment

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Environments](https://www.tensorflow.org/agents/tutorials/2_environments_tutorial) - [Train a Deep Q Network with TF-Agents](https://www.tensorflow.org/agents/tutorials/1_dqn_tutorial) - [REINFORCE agent](https://www.tensorflow.org/agents/tutorials/6_reinforce_tutorial) - [Checkpointer and PolicySaver](https://www.tensorflow.org/agents/tutorials/10_checkpointer_policysaver_tutorial) - [Drivers](https://www.tensorflow.org/agents/tutorials/4_drivers_tutorial) |

Note that by default a TimeLimit wrapper is used to limit episode lengths
to the default benchmarks defined by the registered environments.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `environment_name` | Name for the environment to load. |
| `discount` | Discount to use for the environment. |
| `max_episode_steps` | If None the max_episode_steps will be set to the default step limit defined in the environment's spec. No limit is applied if set to 0 or if there is no max_episode_steps set in the environment's spec. |
| `gym_env_wrappers` | Iterable with references to wrapper classes to use directly on the gym environment. |
| `env_wrappers` | Iterable with references to wrapper classes to use on the gym_wrapped environment. |
| `spec_dtype_map` | A dict that maps gym spaces to np dtypes to use as the default dtype for the arrays. An easy way how to configure a custom mapping through Gin is to define a gin-configurable function that returns desired mapping and call it in your Gin congif file, for example: `suite_gym.load.spec_dtype_map = @get_custom_mapping()`. |
| `gym_kwargs` | Optional kwargs to pass to the Gym environment class. |
| `render_kwargs` | Optional kwargs for rendering to pass to `render()` of the gym_wrapped environment. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A PyEnvironment instance. ||

<br />