Table of Contents

Class VectorObservationWrapper<TWObs, TObs, TAct>

Namespace
Gym.Vector
Assembly
Gym.dll

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

TWObs

The wrapper's batched observation type.

TObs

The env's batched observation type.

TAct

The batched action type.

Inheritance
VectorEnv<TWObs, TAct>
VectorWrapper<TWObs, TAct, TObs, TAct>
VectorObservationWrapper<TWObs, TObs, TAct>
Implements
Derived
Inherited Members
Extension Methods

Remarks

Constructors

VectorObservationWrapper(VectorEnv<TObs, TAct>)

Wraps env, checking its autoreset mode.

protected VectorObservationWrapper(VectorEnv<TObs, TAct> env)

Parameters

env VectorEnv<TObs, TAct>

The vector env to wrap.

Exceptions

TypeError

Thrown when env is null.

ValueError

Thrown when the env's autoreset_mode is neither NEXT_STEP nor DISABLED, with Gymnasium's message.

Methods

Observations(TObs)

The transform (observations(observations)).

public abstract TWObs Observations(TObs observations)

Parameters

observations TObs

The 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

seeds IReadOnlyList<BigInteger?>

The seeds.

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

seed BigInteger?

The seed.

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

actions TAct

The actions.

Returns

VectorStepResult<TWObs>

The transition with transformed observations.