Table of Contents

Class ObservationWrapper<TWObs, TObs, TAct>

Namespace
Gym.Envs
Assembly
Gym.dll

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

TWObs

The transformed observation type.

TObs

The env's observation type.

TAct

The action type, passed through.

Inheritance
Env<TWObs, TAct>
Wrapper<TWObs, TAct, TObs, TAct>
ObservationWrapper<TWObs, TObs, TAct>
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

env Env<TObs, TAct>

The env whose observations are transformed.

Exceptions

TypeError

Thrown when env is null.

Methods

Observation(TObs)

The transformation (observation(observation)).

public abstract TWObs Observation(TObs observation)

Parameters

observation TObs

The 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

seed BigInteger?

The seed, passed on.

options IReadOnlyDictionary<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

action TAct

The action, passed on.

Returns

StepResult<TWObs>

(self.observation(observation), reward, terminated, truncated, info).