Table of Contents

Class TransformObservationVector<TWObs, TObs, TAct>

Namespace
Gym.Wrappers.Vector
Assembly
Gym.dll

Applies one function to the whole batch of observations, as Gymnasium's vector TransformObservation does; give the spaces when the function changes them. Use VectorizeTransformObservation<TWObs, TObs, TAct> to apply a single-env wrapper's function per sub-env instead.

[PyName("TransformObservation")]
public class TransformObservationVector<TWObs, TObs, TAct> : VectorObservationWrapper<TWObs, 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, passed through.

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

Remarks

Without spaces the env's are kept; with only a single space, the batched one is batch_space(single, num_envs). When the batched space is not the batched single space, a warning says so (Gymnasium's text, which prints the env's observation space).

Reference: gymnasium/wrappers/vector/vectorize_observation.py.

Constructors

TransformObservationVector(VectorEnv<TObs, TAct>, Func<TObs, TWObs>, Space<TWObs>?, Space?)

Wraps env.

public TransformObservationVector(VectorEnv<TObs, TAct> env, Func<TObs, TWObs> func, Space<TWObs>? observationSpace = null, Space? singleObservationSpace = null)

Parameters

env VectorEnv<TObs, TAct>

The vector env.

func Func<TObs, TWObs>

The function of the batched observations.

observationSpace Space<TWObs>

The wrapper's batched space, or null.

singleObservationSpace Space

The wrapper's single space, or null.

Exceptions

TypeError

Thrown when env is null, or a space does not hold TWObs.

ValueError

Thrown for a SAME_STEP env (the vector observation wrappers' rule).

Properties

Func

The function of the batched observations (func).

public Func<TObs, TWObs> Func { get; set; }

Property Value

Func<TObs, TWObs>

Methods

Observations(TObs)

Applies Func to the batch.

public override TWObs Observations(TObs observations)

Parameters

observations TObs

The env's batched observations.

Returns

TWObs

The function's result.