Class ObservationWrapper<TWObs, TObs, TAct>
Transforms every observation Reset(BigInteger?, IReadOnlyDictionary<string, object?>?) and Step(TAct) return through Observation(TObs). If the transformation changes the observation space, assign the new one to ObservationSpace in the constructor.
public abstract class ObservationWrapper<TWObs, TObs, TAct> : Wrapper<TWObs, TAct, TObs, TAct>, IDynamicAttributes, IWrapper, IEnv, IDisposable
Type Parameters
TWObsThe transformed observation type.
TObsThe env's observation type.
TActThe action type, passed through.
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Reference: gymnasium/core.py.
Constructors
ObservationWrapper(Env<TObs, TAct>)
Wraps env.
protected ObservationWrapper(Env<TObs, TAct> env)
Parameters
envEnv<TObs, TAct>The env whose observations are transformed.
Exceptions
Methods
Observation(TObs)
The transformation (observation(observation)).
public abstract TWObs Observation(TObs observation)
Parameters
observationTObsThe env's observation.
Returns
- TWObs
The transformed observation.
Reset(BigInteger?, IReadOnlyDictionary<string, object?>?)
Resets the env and returns the transformed first observation with the env's info.
public override ResetResult<TWObs> Reset(BigInteger? seed = null, IReadOnlyDictionary<string, object?>? options = null)
Parameters
seedBigInteger?The seed, passed on.
optionsIReadOnlyDictionary<string, object>The options, passed on.
Returns
- ResetResult<TWObs>
(self.observation(obs), info).
Exceptions
- Error
Thrown for a negative seed.
Step(TAct)
Steps the env and returns its transition with the observation transformed.
public override StepResult<TWObs> Step(TAct action)
Parameters
actionTActThe action, passed on.
Returns
- StepResult<TWObs>
(self.observation(observation), reward, terminated, truncated, info).