Table of Contents

Enum AutoresetMode

Namespace
Gym.Vector
Assembly
Gym.dll

When a vector env resets a sub-env whose episode ended: on the next step (NextStep, Gymnasium's default), within the same step (SameStep, the ended episode's last observation and info moved into final_obs/final_info), or never (Disabled, the caller resets through reset_mask). A vector env states its mode in metadata["autoreset_mode"], and training code must handle the mode it gets: the same step's observation means different things in each.

[PyEnum("AutoresetMode")]
public enum AutoresetMode
Extension Methods

Fields

[PyName("NEXT_STEP")] [PyValue("NextStep")] NextStep = 0

Gymnasium's AutoresetMode.NEXT_STEP ("NextStep"): the step after an episode's end resets the sub-env and returns its first observation, with a reward of 0.

[PyName("SAME_STEP")] [PyValue("SameStep")] SameStep = 1

Gymnasium's AutoresetMode.SAME_STEP ("SameStep"): the ending step resets at once, returning the new episode's first observation and the ended one's last in final_obs.

[PyName("DISABLED")] [PyValue("Disabled")] Disabled = 2

Gymnasium's AutoresetMode.DISABLED ("Disabled"): no reset at all; stepping an ended sub-env without resetting it through reset_mask fails.

Remarks

A C# enum (DR-77, DR-84) that stands for Gymnasium's Python Enum (PyEnumAttribute): Python's view of a member is AutoresetModes's, named NEXT_STEP, valued "NextStep", printed <AutoresetMode.NEXT_STEP: 'NextStep'> inside a printed metadata dict (Repr(object?)), and parsed from its value only (Of(string?); the member name is refused, as Python refuses it). The vector envs' constructors take a member or its string (autoresetMode: "SameStep"), as Python's do.

Footgun: a member's ToString() is its C# name ("NextStep"), not Python's str ("AutoresetMode.NEXT_STEP"); messages format members through Str(AutoresetMode), and a member boxed in a metadata dict compares with Equals(object) or a pattern (mode is AutoresetMode.SameStep), never with ReferenceEquals(object, object).

Reference: gymnasium/vector/vector_env.py.