<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 child pages in navigation</div><iclass="icon"><svg><usehref="#svg-arrow-right"></use></svg></i></label><ulclass="current">
<liclass="toctree-l2 current current-page"><aclass="current reference internal"href="#">Misc Wrappers</a></li>
<liclass="toctree-l2"><aclass="reference internal"href="../../../environments/classic_control/mountain_car_continuous/">Mountain Car Continuous</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">AtariPreprocessing</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">noop_max</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">30</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">frame_skip</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">4</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">screen_size</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">84</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">terminal_on_life_loss</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>, <emclass="sig-param"><spanclass="n"><spanclass="pre">grayscale_obs</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">grayscale_newaxis</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>, <emclass="sig-param"><spanclass="n"><spanclass="pre">scale_obs</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="headerlink"href="#gymnasium.wrappers.AtariPreprocessing"title="Permalink to this definition">#</a></dt>
<dd><p>Atari 2600 preprocessing wrapper.</p>
<p>This class follows the guidelines in Machado et al. (2018),
“Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents”.</p>
<p>Specifically, the following preprocess stages applies to the atari environment:</p>
<ulclass="simple">
<li><p>Noop Reset: Obtains the initial state by taking a random number of no-ops on reset, default max 30 no-ops.</p></li>
<li><p>Frame skipping: The number of frames skipped between steps, 4 by default</p></li>
<li><p>Max-pooling: Pools over the most recent two observations from the frame skips</p></li>
<li><dlclass="simple">
<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>
</dd>
</dl>
</li>
<li><p>Resize to a square image: Resizes the atari environment original observation shape from 210x180 to 84x84 by default</p></li>
<li><p>Grayscale observation: If the observation is colour or greyscale, by default, greyscale.</p></li>
<li><p>Scale observation: If to scale the observation between [0, 1) or [0, 255), by default, not scaled.</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 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">AutoResetWrapper</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="headerlink"href="#gymnasium.wrappers.AutoResetWrapper"title="Permalink to this definition">#</a></dt>
<dd><p>A class for providing an automatic reset functionality for gymnasium environments when calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.step()</span></code>.</p>
<p>When calling step causes <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.step()</span></code> to return <cite>terminated=True</cite> or <cite>truncated=True</cite>, <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.reset()</span></code> is called,
and the return format of <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.step()</span></code> is as follows: <codeclass="docutils literal notranslate"><spanclass="pre">(new_obs,</span><spanclass="pre">final_reward,</span><spanclass="pre">final_terminated,</span><spanclass="pre">final_truncated,</span><spanclass="pre">info)</span></code>
with new step API and <codeclass="docutils literal notranslate"><spanclass="pre">(new_obs,</span><spanclass="pre">final_reward,</span><spanclass="pre">final_done,</span><spanclass="pre">info)</span></code> with the old step API.</p>
<blockquote>
<div><ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">new_obs</span></code> is the first observation after calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.reset()</span></code></p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">final_reward</span></code> is the reward after calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.step()</span></code>, prior to calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.reset()</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">final_terminated</span></code> is the terminated value before calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.reset()</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">final_truncated</span></code> is the truncated value before calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.reset()</span></code>. Both <cite>final_terminated</cite> and <cite>final_truncated</cite> cannot be False.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">info</span></code> is a dict containing all the keys from the info dict returned by the call to <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.reset()</span></code>,
with an additional key “final_observation” containing the observation returned by the last call to <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.step()</span></code>
and “final_info” containing the info dict returned by the last call to <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.env.step()</span></code>.</p></li>
</ul>
</div></blockquote>
<dlclass="simple">
<dt>Warning: When using this wrapper to collect rollouts, note that when <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.step()</span></code> returns <cite>terminated</cite> or <cite>truncated</cite>, a</dt><dd><p>new observation from after calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.reset()</span></code> is returned by <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.step()</span></code> alongside the
final reward, terminated and truncated state from the previous episode.
If you need the final state from the previous episode, you need to retrieve it via the
“final_observation” key in the info dict.
Make sure you know what you’re doing if you use this wrapper!</p>
</dd>
</dl>
<p>A class for providing an automatic reset functionality for gymnasium environments when calling <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">self.step()</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">EnvCompatibility</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">old_env</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">LegacyEnv</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">render_mode</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">str</span><spanclass="p"><spanclass="pre">]</span></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="headerlink"href="#gymnasium.wrappers.EnvCompatibility"title="Permalink to this definition">#</a></dt>
<dd><p>A wrapper which can transform an environment from the old API to the new API.</p>
<p>Old step API refers to step() method returning (observation, reward, done, info), and reset() only retuning the observation.
New step API refers to step() method returning (observation, reward, terminated, truncated, info) and reset() returning (observation, info).
(Refer to docs for details on the API change)</p>
<p>Known limitations:
- Environments that use <cite>self.np_random</cite> might not work as expected.</p>
<p>A wrapper which converts old-style envs to valid modern envs.</p>
<p>Some information may be lost in the conversion, so we recommend updating your environment.</p>
<li><p><strong>old_env</strong> (<em>LegacyEnv</em>) – the env to wrap, implemented with the old API</p></li>
<li><p><strong>render_mode</strong> (<em>str</em>) – the render mode to use when rendering the environment, passed automatically to env.render</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">StepAPICompatibility</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">output_truncation_bool</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="headerlink"href="#gymnasium.wrappers.StepAPICompatibility"title="Permalink to this definition">#</a></dt>
<dd><p>A wrapper which can transform an environment from new step API to old and vice-versa.</p>
<p>Old step API refers to step() method returning (observation, reward, done, info)
New step API refers to step() method returning (observation, reward, terminated, truncated, info)
<li><p><strong>env</strong> (<em>gym.Env</em>) – the env to wrap. Can be in old or new API</p></li>
<li><p><strong>output_truncation_bool</strong> (<em>bool</em>) – Apply to convert environment to use new step API that returns two bool. (True by default)</p></li>
<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">apply_api_compatibility</span><spanclass="o">=</span><spanclass="kc">True</span><spanclass="p">)</span><spanclass="c1"># set to old API</span>
<spanclass="gp">>>></span><spanclass="n">env</span><spanclass="o">=</span><spanclass="n">StepAPICompatibility</span><spanclass="p">(</span><spanclass="n">CustomEnv</span><spanclass="p">(),</span><spanclass="n">output_truncation_bool</span><spanclass="o">=</span><spanclass="kc">False</span><spanclass="p">)</span><spanclass="c1"># manually using wrapper on unregistered envs</span>
</pre></div>
</div>
<p>A wrapper which can transform an environment from new step API to old and vice-versa.</p>
<li><p><strong>env</strong> (<em>gym.Env</em>) – the env to wrap. Can be in old or new API</p></li>
<li><p><strong>output_truncation_bool</strong> (<em>bool</em>) – Whether the wrapper’s step method outputs two booleans (new API) or one boolean (old API)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</section>
<sectionid="passive-environment-checker">
<h2>Passive Environment Checker<aclass="headerlink"href="#passive-environment-checker"title="Permalink to this heading">#</a></h2>
<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></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#gymnasium.wrappers.PassiveEnvChecker"title="Permalink to this definition">#</a></dt>
<dd><p>A passive environment checker wrapper that surrounds the step, reset and render functions to check they follow the gymnasium API.</p>
<p>Initialises the wrapper with the environments, run the observation and action space tests.</p>
</dd></dl>
</section>
<sectionid="human-rendering">
<h2>Human Rendering<aclass="headerlink"href="#human-rendering"title="Permalink to this heading">#</a></h2>
<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></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#gymnasium.wrappers.HumanRendering"title="Permalink to this definition">#</a></dt>
<dd><p>Performs human rendering for an environment that only supports “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">wrapped</span><spanclass="o">.</span><spanclass="n">reset</span><spanclass="p">()</span><spanclass="c1"># This will start rendering to the screen</span>
</pre></div>
</div>
<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">env</span><spanclass="o">.</span><spanclass="n">reset</span><spanclass="p">()</span><spanclass="c1"># This will start rendering to the screen</span>
</pre></div>
</div>
<dl>
<dt>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</dt><dd><p>will always return an empty list:</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">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></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="headerlink"href="#gymnasium.wrappers.OrderEnforcing"title="Permalink to this definition">#</a></dt>
<dd><p>A wrapper that will produce an error if <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code> is called before an initial <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code>.</p>
<p>A wrapper that will produce an error if <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code> is called before an initial <codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</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">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></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">deque_size</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><spanclass="sig-paren">)</span><aclass="headerlink"href="#gymnasium.wrappers.RecordEpisodeStatistics"title="Permalink 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.</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>return_queue</strong>– 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>– The lengths of the last <codeclass="docutils literal notranslate"><spanclass="pre">deque_size</span></code>-many episodes</p></li>
</ul>
</dd>
</dl>
<p>This wrapper will keep track of cumulative rewards and episode lengths.</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 wrapper</p></li>
<li><p><strong>deque_size</strong>– The size of the buffers <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">return_queue</span></code> and <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">length_queue</span></code></p></li>
</ul>
</dd>
</dl>
</dd></dl>
</section>
<sectionid="record-video">
<h2>Record Video<aclass="headerlink"href="#record-video"title="Permalink to this heading">#</a></h2>
<dd><p>This wrapper records videos of rollouts.</p>
<p>Usually, you only want to record episodes intermittently, say every hundredth episode.
To do this, you can specify <strong>either</strong><codeclass="docutils literal notranslate"><spanclass="pre">episode_trigger</span></code><strong>or</strong><codeclass="docutils literal notranslate"><spanclass="pre">step_trigger</span></code> (not both).
They should be functions returning a boolean that indicates whether a recording should be started at the
current episode or step, respectively.
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.
By default, the recording will be stopped once a <cite>terminated</cite> or <cite>truncated</cite> signal has been emitted by the environment. However, you can
also create recordings of fixed length (possibly spanning several episodes) by passing a strictly positive value for
<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>
<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></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="headerlink"href="#gymnasium.wrappers.RenderCollection"title="Permalink to this definition">#</a></dt>
<dd><p>Save collection of render frames.</p>
<p>Initialize a <aclass="reference internal"href="#gymnasium.wrappers.RenderCollection"title="gymnasium.wrappers.RenderCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">RenderCollection</span></code></a> instance.</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">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">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">]</span></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="headerlink"href="#gymnasium.wrappers.TimeLimit"title="Permalink to this definition">#</a></dt>
<dd><p>This wrapper will issue a <cite>truncated</cite> signal 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.</p>
<p>Initializes the <aclass="reference internal"href="#gymnasium.wrappers.TimeLimit"title="gymnasium.wrappers.TimeLimit"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">TimeLimit</span></code></a> wrapper with an environment and the number of steps after which truncation will occur.</p>
<li><p><strong>env</strong>– The environment to apply the wrapper</p></li>
<li><p><strong>max_episode_steps</strong>– An optional max episode steps (if <codeclass="docutils literal notranslate"><spanclass="pre">Ǹone</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">env.spec.max_episode_steps</span></code> is used)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</section>
<sectionid="vector-list-info">
<h2>Vector List Info<aclass="headerlink"href="#vector-list-info"title="Permalink to this heading">#</a></h2>
<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">VectorListInfo</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">env</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#gymnasium.wrappers.VectorListInfo"title="Permalink to this definition">#</a></dt>
<dd><p>Converts infos of vectorized environments from dict to List[dict].</p>
<p>This wrapper converts the info format of a
vector environment from a dictionary to a list of dictionaries.
This wrapper is intended to be used around vectorized
environments. If using other wrappers that perform
operation on info like <cite>RecordEpisodeStatistics</cite> this
<ddclass="field-odd"><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>