Class VectorObservationWrapper<TWObs, TObs, TAct>
A vector wrapper that changes only the observations, through Observations(TObs), on reset and on every
step. It refuses a SAME_STEP env: there the batch mixes new and final observations, which a transform of
the batch cannot tell apart.
public abstract class VectorObservationWrapper<TWObs, TObs, TAct> : VectorWrapper<TWObs, TAct, TObs, TAct>, IVectorEnv, IDisposable
Type Parameters
TWObsThe wrapper's batched observation type.
TObsThe env's batched observation type.
TActThe batched action type.
- Inheritance
-
VectorEnv<TWObs, TAct>VectorWrapper<TWObs, TAct, TObs, TAct>VectorObservationWrapper<TWObs, TObs, TAct>
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Reference: gymnasium/vector/vector_env.py.
Constructors
VectorObservationWrapper(VectorEnv<TObs, TAct>)
Wraps env, checking its autoreset mode.
protected VectorObservationWrapper(VectorEnv<TObs, TAct> env)
Parameters
envVectorEnv<TObs, TAct>The vector env to wrap.
Exceptions
- TypeError
Thrown when
envis null.- ValueError
Thrown when the env's
autoreset_modeis neitherNEXT_STEPnorDISABLED, with Gymnasium's message.
Methods
Observations(TObs)
The transform (observations(observations)).
public abstract TWObs Observations(TObs observations)
Parameters
observationsTObsThe env's batched observations.
Returns
- TWObs
The wrapper's batched observations.
Reset(IReadOnlyList<BigInteger?>, IReadOnlyDictionary<string, object?>?)
Resets the env with one seed per sub-env and transforms its observations.
public override VectorResetResult<TWObs> Reset(IReadOnlyList<BigInteger?> seeds, IReadOnlyDictionary<string, object?>? options = null)
Parameters
seedsIReadOnlyList<BigInteger?>The seeds.
optionsIReadOnlyDictionary<string, object>The options.
Returns
- VectorResetResult<TWObs>
The transformed observations and the env's infos.
Reset(BigInteger?, IReadOnlyDictionary<string, object?>?)
Resets the env and transforms its observations.
public override VectorResetResult<TWObs> Reset(BigInteger? seed = null, IReadOnlyDictionary<string, object?>? options = null)
Parameters
seedBigInteger?The seed.
optionsIReadOnlyDictionary<string, object>The options.
Returns
- VectorResetResult<TWObs>
The transformed observations and the env's infos.
Step(TAct)
Steps the env and transforms its observations; the rewards, flags and infos pass through.
public override VectorStepResult<TWObs> Step(TAct actions)
Parameters
actionsTActThe actions.
Returns
- VectorStepResult<TWObs>
The transition with transformed observations.