Class TransformObservationVector<TWObs, TObs, TAct>
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
TWObsThe wrapper's batched observation type.
TObsThe env's batched observation type.
TActThe 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
envVectorEnv<TObs, TAct>The vector env.
funcFunc<TObs, TWObs>The function of the batched observations.
observationSpaceSpace<TWObs>The wrapper's batched space, or null.
singleObservationSpaceSpaceThe wrapper's single space, or null.
Exceptions
- TypeError
Thrown when
envis null, or a space does not holdTWObs.- ValueError
Thrown for a
SAME_STEPenv (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
observationsTObsThe env's batched observations.
Returns
- TWObs
The function's result.