<linkrel="index"title="Index"href="../../../genindex/"/><linkrel="search"title="Search"href="../../../search/"/><linkrel="next"title="Action Wrappers"href="../action_wrappers/"/><linkrel="prev"title="List of Wrappers"href="../table/"/>
<liclass="toctree-l1 current has-children"><aclass="reference internal"href="../">Wrappers</a><inputchecked=""class="toctree-checkbox"id="toctree-checkbox-2"name="toctree-checkbox-2"role="switch"type="checkbox"/><labelfor="toctree-checkbox-2"><divclass="visually-hidden">Toggle navigation of Wrappers</div><iclass="icon"><svg><usehref="#svg-arrow-right"></use></svg></i></label><ulclass="current">
<liclass="toctree-l2"><aclass="reference internal"href="../../../environments/classic_control/mountain_car_continuous/">Mountain Car Continuous</a></li>
<liclass="toctree-l1 has-children"><aclass="reference internal"href="../../../environments/toy_text/">Toy Text</a><inputclass="toctree-checkbox"id="toctree-checkbox-6"name="toctree-checkbox-6"role="switch"type="checkbox"/><labelfor="toctree-checkbox-6"><divclass="visually-hidden">Toggle navigation of Toy Text</div><iclass="icon"><svg><usehref="#svg-arrow-right"></use></svg></i></label><ul>
<liclass="toctree-l2"><aclass="reference internal"href="../../../tutorials/gymnasium_basics/environment_creation/">Make your own custom environment</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="../../../tutorials/gymnasium_basics/vector_envs_tutorial/">Training A2C with Vector Envs and Domain Randomization</a></li>
<liclass="toctree-l1 has-children"><aclass="reference internal"href="../../../tutorials/training_agents/">Training Agents</a><inputclass="toctree-checkbox"id="toctree-checkbox-9"name="toctree-checkbox-9"role="switch"type="checkbox"/><labelfor="toctree-checkbox-9"><divclass="visually-hidden">Toggle navigation of Training Agents</div><iclass="icon"><svg><usehref="#svg-arrow-right"></use></svg></i></label><ul>
<liclass="toctree-l2"><aclass="reference internal"href="../../../tutorials/training_agents/reinforce_invpend_gym_v26/">Training using REINFORCE for Mujoco</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="../../../tutorials/training_agents/blackjack_tutorial/">Solving Blackjack with Q-Learning</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/Farama-Foundation/Gymnasium/blob/main/docs/README.md">Contribute to the Docs</a></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">TimeLimit</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">max_episode_steps</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/common/#TimeLimit"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.TimeLimit"title="Link to this definition">¶</a></dt>
<dd><p>Limits the number of steps for an environment through truncating the environment if a maximum number of timesteps is exceeded.</p>
<p>If a truncation is not defined inside the environment itself, this is the only place that the truncation signal is issued.
Critically, this is different from the <cite>terminated</cite> signal that originates from the underlying environment as part of the MDP.
No vector wrapper exists.</p>
<dl>
<dt>Example using the TimeLimit wrapper:</dt><dd><divclass="doctest highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="gp">>>></span><spanclass="kn">from</span><spanclass="nn">gymnasium.wrappers</span><spanclass="kn">import</span><spanclass="n">TimeLimit</span>
<dt>Example of <cite>TimeLimit</cite> determining the episode step</dt><dd><divclass="doctest highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="gp">>>></span><spanclass="n">env</span><spanclass="o">=</span><spanclass="n">gym</span><spanclass="o">.</span><spanclass="n">make</span><spanclass="p">(</span><spanclass="s2">"CartPole-v1"</span><spanclass="p">,</span><spanclass="n">max_episode_steps</span><spanclass="o">=</span><spanclass="mi">3</span><spanclass="p">)</span>
<li><p><strong>env</strong>– The environment to apply the wrapper</p></li>
<li><p><strong>max_episode_steps</strong>– the environment step after which the episode is truncated (<codeclass="docutils literal notranslate"><spanclass="pre">elapsed</span><spanclass="pre">>=</span><spanclass="pre">max_episode_steps</span></code>)</p></li>
<dd><p>Records videos of environment episodes using the environment’s render function.</p>
<p>Usually, you only want to record episodes intermittently, say every hundredth episode or at every thousandth environment step.
To do this, you can specify <codeclass="docutils literal notranslate"><spanclass="pre">episode_trigger</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">step_trigger</span></code>.
They should be functions returning a boolean that indicates whether a recording should be started at the
current episode or step, respectively.</p>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">episode_trigger</span></code> should return <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> on the episode when recording should start.
The <codeclass="docutils literal notranslate"><spanclass="pre">step_trigger</span></code> should return <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> on the n-th environment step that the recording should be started, where n sums over all previous episodes.
If neither <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">episode_trigger</span></code> nor <codeclass="docutils literal notranslate"><spanclass="pre">step_trigger</span></code> is passed, a default <codeclass="docutils literal notranslate"><spanclass="pre">episode_trigger</span></code> will be employed, i.e. <aclass="reference internal"href="../../utils/#gymnasium.utils.save_video.capped_cubic_video_schedule"title="gymnasium.utils.save_video.capped_cubic_video_schedule"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">capped_cubic_video_schedule()</span></code></a>.
This function starts a video at every episode that is a power of 3 until 1000 and then every 1000 episodes.
By default, the recording will be stopped once reset is called.
However, you can also create recordings of fixed length (possibly spanning several episodes)
by passing a strictly positive value for <codeclass="docutils literal notranslate"><spanclass="pre">video_length</span></code>.</p>
<p>No vector version of the wrapper exists.</p>
<dl>
<dt>Examples - Run the environment for 50 episodes, and save the video every 10 episodes starting from the 0th:</dt><dd><divclass="doctest highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="gp">>>></span><spanclass="kn">import</span><spanclass="nn">os</span>
<dt>Examples - Run the environment for 5 episodes, start a recording every 200th step, making sure each video is 100 frames long:</dt><dd><divclass="doctest highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="gp">>>></span><spanclass="kn">import</span><spanclass="nn">os</span>
<dt>Examples - Run 3 episodes, record everything, but in chunks of 1000 frames:</dt><dd><divclass="doctest highlight-default notranslate"><divclass="highlight"><pre><span></span><spanclass="gp">>>></span><spanclass="kn">import</span><spanclass="nn">os</span>
<li><p><strong>env</strong>– The environment that will be wrapped</p></li>
<li><p><strong>video_folder</strong> (<em>str</em>) – The folder where the recordings will be stored</p></li>
<li><p><strong>episode_trigger</strong>– Function that accepts an integer and returns <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> iff a recording should be started at this episode</p></li>
<li><p><strong>step_trigger</strong>– Function that accepts an integer and returns <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> iff a recording should be started at this step</p></li>
<li><p><strong>video_length</strong> (<em>int</em>) – The length of recorded episodes. If 0, entire episodes are recorded.
Otherwise, snippets of the specified length are captured</p></li>
<li><p><strong>name_prefix</strong> (<em>str</em>) – Will be prepended to the filename of the recordings</p></li>
<li><p><strong>fps</strong> (<em>int</em>) – The frame per second in the video. Provides a custom video fps for environment, if <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code> then
the environment metadata <codeclass="docutils literal notranslate"><spanclass="pre">render_fps</span></code> key is used if it exists, otherwise a default value of 30 is used.</p></li>
<li><p><strong>disable_logger</strong> (<em>bool</em>) – Whether to disable moviepy logger or not, default it is disabled</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">RecordEpisodeStatistics</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">buffer_length</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">int</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">100</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">stats_key</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">str</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">'episode'</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/common/#RecordEpisodeStatistics"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.RecordEpisodeStatistics"title="Link to this definition">¶</a></dt>
<dd><p>This wrapper will keep track of cumulative rewards and episode lengths.</p>
<p>At the end of an episode, the statistics of the episode will be added to <codeclass="docutils literal notranslate"><spanclass="pre">info</span></code>
using the key <codeclass="docutils literal notranslate"><spanclass="pre">episode</span></code>. If using a vectorized environment also the key
<codeclass="docutils literal notranslate"><spanclass="pre">_episode</span></code> is used which indicates whether the env at the respective index has
the episode statistics.
A vector version of the wrapper exists, <aclass="reference internal"href="../../vector/wrappers/#gymnasium.wrappers.vector.RecordEpisodeStatistics"title="gymnasium.wrappers.vector.RecordEpisodeStatistics"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.vector.RecordEpisodeStatistics</span></code></a>.</p>
<p>After the completion of an episode, <codeclass="docutils literal notranslate"><spanclass="pre">info</span></code> will look like this:</p>
<spanclass="gp">... </span><spanclass="s2">"t"</span><spanclass="p">:</span><spanclass="s2">"<elapsed time since beginning of episode>"</span>
<spanclass="gp">... </span><spanclass="s2">"r"</span><spanclass="p">:</span><spanclass="s2">"<array of cumulative reward>"</span><spanclass="p">,</span>
<spanclass="gp">... </span><spanclass="s2">"l"</span><spanclass="p">:</span><spanclass="s2">"<array of episode length>"</span><spanclass="p">,</span>
<spanclass="gp">... </span><spanclass="s2">"t"</span><spanclass="p">:</span><spanclass="s2">"<array of elapsed time since beginning of episode>"</span>
<li><p><strong>time_queue</strong> (<em>*</em>) – The time length of the last <codeclass="docutils literal notranslate"><spanclass="pre">deque_size</span></code>-many episodes</p></li>
<li><p><strong>return_queue</strong> (<em>*</em>) – The cumulative rewards of the last <codeclass="docutils literal notranslate"><spanclass="pre">deque_size</span></code>-many episodes</p></li>
<li><p><strong>length_queue</strong> (<em>*</em>) – The lengths of the last <codeclass="docutils literal notranslate"><spanclass="pre">deque_size</span></code>-many episodes</p></li>
</ul>
</dd>
</dl>
<dlclass="simple">
<dt>Change logs:</dt><dd><ulclass="simple">
<li><p>v0.15.4 - Initially added</p></li>
<li><p>v1.0.0 - Removed vector environment support (see <aclass="reference internal"href="../../vector/wrappers/#gymnasium.wrappers.vector.RecordEpisodeStatistics"title="gymnasium.wrappers.vector.RecordEpisodeStatistics"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.vector.RecordEpisodeStatistics</span></code></a>) and add attribute <codeclass="docutils literal notranslate"><spanclass="pre">time_queue</span></code></p></li>
<li><p><strong>env</strong> (<aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.Env"><em>Env</em></a>) – The environment to apply the wrapper</p></li>
<li><p><strong>buffer_length</strong>– The size of the buffers <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">return_queue</span></code>, <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">length_queue</span></code> and <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">time_queue</span></code></p></li>
<li><p><strong>stats_key</strong>– The info key for the episode statistics</p></li>
<dt>Termination signal when a life is lost: When the agent losses a life during the environment, then the environment is terminated.</dt><dd><p>Turned off by default. Not recommended by Machado et al. (2018).</p>
<li><p><strong>env</strong> (<aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.Env"><em>Env</em></a>) – The environment to apply the preprocessing</p></li>
<li><p><strong>noop_max</strong> (<em>int</em>) – For No-op reset, the max number no-ops actions are taken at reset, to turn off, set to 0.</p></li>
<li><p><strong>frame_skip</strong> (<em>int</em>) – The number of frames between new observation the agents observations effecting the frequency at which the agent experiences the game.</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">Autoreset</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/common/#Autoreset"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.Autoreset"title="Link to this definition">¶</a></dt>
<dd><p>The wrapped environment is automatically reset when a terminated or truncated state is reached.</p>
<p>This follows the vector autoreset api where on the step after an episode terminates or truncated then the environment is reset.</p>
<dlclass="simple">
<dt>Change logs:</dt><dd><ulclass="simple">
<li><p>v0.24.0 - Initially added as <cite>AutoResetWrapper</cite></p></li>
<li><p>v1.0.0 - renamed to <cite>Autoreset</cite> and autoreset order was changed to reset on the step after the environment terminates or truncates. As a result, <cite>“final_observation”</cite> and <cite>“final_info”</cite> is removed.</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">PassiveEnvChecker</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/common/#PassiveEnvChecker"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.PassiveEnvChecker"title="Link to this definition">¶</a></dt>
<dd><p>A passive wrapper that surrounds the <codeclass="docutils literal notranslate"><spanclass="pre">step</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">reset</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">render</span></code> functions to check they follow Gymnasium’s API.</p>
<p>This wrapper is automatically applied during make and can be disabled with <cite>disable_env_checker</cite>.
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">HumanRendering</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/rendering/#HumanRendering"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.HumanRendering"title="Link to this definition">¶</a></dt>
<dd><p>Allows human like rendering for environments that support “rgb_array” rendering.</p>
<p>This wrapper is particularly useful when you have implemented an environment that can produce
RGB images but haven’t implemented any code to render the images to the screen.
If you want to use this wrapper with your environments, remember to specify <codeclass="docutils literal notranslate"><spanclass="pre">"render_fps"</span></code>
in the metadata of your environment.</p>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">render_mode</span></code> of the wrapped environment must be either <codeclass="docutils literal notranslate"><spanclass="pre">'rgb_array'</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">'rgb_array_list'</span></code>.</p>
<spanclass="gp">>>></span><spanclass="n">obs</span><spanclass="p">,</span><spanclass="n">_</span><spanclass="o">=</span><spanclass="n">wrapped</span><spanclass="o">.</span><spanclass="n">reset</span><spanclass="p">()</span><spanclass="c1"># This will start rendering to the screen</span>
<p>The wrapper can also be applied directly when the environment is instantiated, simply by passing
<codeclass="docutils literal notranslate"><spanclass="pre">render_mode="human"</span></code> to <codeclass="docutils literal notranslate"><spanclass="pre">make</span></code>. The wrapper will only be applied if the environment does not
implement human-rendering natively (i.e. <codeclass="docutils literal notranslate"><spanclass="pre">render_mode</span></code> does not contain <codeclass="docutils literal notranslate"><spanclass="pre">"human"</span></code>).</p>
<spanclass="gp">>>></span><spanclass="n">obs</span><spanclass="p">,</span><spanclass="n">_</span><spanclass="o">=</span><spanclass="n">env</span><spanclass="o">.</span><spanclass="n">reset</span><spanclass="p">()</span><spanclass="c1"># This will start rendering to the screen</span>
<p>Warning: If the base environment uses <codeclass="docutils literal notranslate"><spanclass="pre">render_mode="rgb_array_list"</span></code>, its (i.e. the <em>base environment’s</em>) render method
<spanclass="gp">>>></span><spanclass="n">env</span><spanclass="o">.</span><spanclass="n">render</span><spanclass="p">()</span><spanclass="c1"># env.render() will always return an empty list!</span>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">OrderEnforcing</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">disable_render_order_enforcing</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">False</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/common/#OrderEnforcing"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.OrderEnforcing"title="Link to this definition">¶</a></dt>
<dd><p>Will produce an error if <codeclass="docutils literal notranslate"><spanclass="pre">step</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">render</span></code> is called before <codeclass="docutils literal notranslate"><spanclass="pre">reset</span></code>.</p>
<spanclass="gr">gymnasium.error.ResetNeeded</span>: <spanclass="n">Cannot call `env.render()` before calling `env.reset()`, if this is an intended action, set `disable_render_order_enforcing=True` on the OrderEnforcer wrapper.</span>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">RenderCollection</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">pop_frames</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">True</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">reset_clean</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">bool</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/rendering/#RenderCollection"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.RenderCollection"title="Link to this definition">¶</a></dt>
<dd><p>Collect rendered frames of an environment such <codeclass="docutils literal notranslate"><spanclass="pre">render</span></code> returns a <codeclass="docutils literal notranslate"><spanclass="pre">list[RenderedFrame]</span></code>.</p>
<p>No vector version of the wrapper exists.</p>
<pclass="rubric">Example</p>
<p>Return the list of frames for the number of steps <codeclass="docutils literal notranslate"><spanclass="pre">render</span></code> wasn’t called.
<li><p><strong>env</strong>– The environment that is being wrapped</p></li>
<li><p><strong>pop_frames</strong> (<em>bool</em>) – If true, clear the collection frames after <codeclass="docutils literal notranslate"><spanclass="pre">meth:render</span></code> is called. Default value is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p></li>
<li><p><strong>reset_clean</strong> (<em>bool</em>) – If true, clear the collection frames when <codeclass="docutils literal notranslate"><spanclass="pre">meth:reset</span></code> is called. Default value is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">JaxToNumpy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><aclass="reference internal"href="../../env/#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/jax_to_numpy/#JaxToNumpy"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.JaxToNumpy"title="Link to this definition">¶</a></dt>
<dd><p>Wraps a Jax-based environment such that it can be interacted with NumPy arrays.</p>
<p>Actions must be provided as numpy arrays and observations will be returned as numpy arrays.
A vector version of the wrapper exists, <aclass="reference internal"href="../../vector/wrappers/#gymnasium.wrappers.vector.JaxToNumpy"title="gymnasium.wrappers.vector.JaxToNumpy"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.vector.JaxToNumpy</span></code></a>.</p>
<pclass="rubric">Notes</p>
<p>The Jax To Numpy and Numpy to Jax conversion does not guarantee a roundtrip (jax -> numpy -> jax) and vice versa.
The reason for this is jax does not support non-array values, therefore numpy <codeclass="docutils literal notranslate"><spanclass="pre">int_32(5)</span><spanclass="pre">-></span><spanclass="pre">DeviceArray([5],</span><spanclass="pre">dtype=jnp.int23)</span></code></p>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">JaxToTorch</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">gym.Env</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">device</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Device</span><spanclass="w"></span><spanclass="p"><spanclass="pre">|</span></span><spanclass="w"></span><spanclass="pre">None</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/jax_to_torch/#JaxToTorch"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.JaxToTorch"title="Link to this definition">¶</a></dt>
<dd><p>Wraps a Jax-based environment so that it can be interacted with PyTorch Tensors.</p>
<p>Actions must be provided as PyTorch Tensors and observations will be returned as PyTorch Tensors.
A vector version of the wrapper exists, <aclass="reference internal"href="../../vector/wrappers/#gymnasium.wrappers.vector.JaxToTorch"title="gymnasium.wrappers.vector.JaxToTorch"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.vector.JaxToTorch</span></code></a>.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">rendered</span></code> this is returned as a NumPy array not a pytorch Tensor.</p>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.wrappers.</span></span><spanclass="sig-name descname"><spanclass="pre">NumpyToTorch</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">gym.Env</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">device</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Device</span><spanclass="w"></span><spanclass="p"><spanclass="pre">|</span></span><spanclass="w"></span><spanclass="pre">None</span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../../../_modules/gymnasium/wrappers/numpy_to_torch/#NumpyToTorch"><spanclass="viewcode-link"><spanclass="pre">[source]</span></span></a><aclass="headerlink"href="#gymnasium.wrappers.NumpyToTorch"title="Link to this definition">¶</a></dt>
<dd><p>Wraps a NumPy-based environment such that it can be interacted with PyTorch Tensors.</p>
<p>Actions must be provided as PyTorch Tensors and observations will be returned as PyTorch Tensors.
A vector version of the wrapper exists, <aclass="reference internal"href="../../vector/wrappers/#gymnasium.wrappers.vector.NumpyToTorch"title="gymnasium.wrappers.vector.NumpyToTorch"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.vector.NumpyToTorch</span></code></a>.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">rendered</span></code> this is returned as a NumPy array not a pytorch Tensor.</p>