Class Autoreset<TObs, TAct>
Resets the env automatically, on the step after an episode ends (Gymnasium's vector autoreset order): that step ignores its action, resets the env and returns the first observation with reward 0 and both signals false, so a loop never needs to call reset after the first.
public class Autoreset<TObs, TAct> : Wrapper<TObs, TAct>, IDynamicAttributes, IWrapper, IEnv, IDisposable, IRecordConstructorArgs
Type Parameters
TObsThe observation type, passed through.
TActThe action type, passed through.
- Inheritance
-
Env<TObs, TAct>Wrapper<TObs, TAct, TObs, TAct>Wrapper<TObs, TAct>Autoreset<TObs, TAct>
- Implements
- Inherited Members
- Extension Methods
Remarks
Since Gymnasium 1.0 the reset happens one step late and the infos carry no final_observation or
final_info: the terminating step's own result is the episode's last. The reset is unseeded and without
options. Reference: gymnasium/wrappers/common.py.
Constructors
Autoreset(Env<TObs, TAct>)
Wraps env.
public Autoreset(Env<TObs, TAct> env)
Parameters
envEnv<TObs, TAct>The env to reset automatically.
Exceptions
Properties
AutoresetPending
Whether the last step ended the episode, so the next step resets instead (Python's autoreset, renamed in
C#, where a member cannot share its class's name).
[PyName("autoreset")]
public bool AutoresetPending { get; set; }
Property Value
SavedKwargs
The recorded constructor arguments, {} (Python's _saved_kwargs).
[PyName("_saved_kwargs")]
public Info SavedKwargs { get; }
Property Value
Methods
Reset(BigInteger?, IReadOnlyDictionary<string, object?>?)
Clears the pending reset, then resets the env.
public override ResetResult<TObs> Reset(BigInteger? seed = null, IReadOnlyDictionary<string, object?>? options = null)
Parameters
seedBigInteger?The seed, passed on.
optionsIReadOnlyDictionary<string, object>The options, passed on.
Returns
- ResetResult<TObs>
The env's first observation and info.
Exceptions
- Error
Thrown for a negative seed.
Step(TAct)
Steps the env, or resets it when the previous step ended the episode.
public override StepResult<TObs> Step(TAct action)
Parameters
actionTActThe action; ignored on a resetting step.
Returns
- StepResult<TObs>
The env's transition, or the reset's observation and info with reward 0 and no signals.