Class FlattenObservation<TObs, TAct>
Flattens every observation into a 1-D array (spaces.utils.flatten), with the flattened space
(flatten_space) as the observation space, as Gymnasium's FlattenObservation does: a Dict or
Tuple of arrays becomes one array, a Discrete a one-hot vector.
public class FlattenObservation<TObs, TAct> : TransformObservation<NDArray, TObs, TAct>, IDynamicAttributes, IWrapper, IEnv, IDisposable, IRecordConstructorArgs
Type Parameters
TObsThe env's observation type.
TActThe action type, passed through.
- Inheritance
-
ObservationWrapper<NDArray, TObs, TAct>TransformObservation<NDArray, TObs, TAct>FlattenObservation<TObs, TAct>
- Implements
- Inherited Members
- Extension Methods
Remarks
Typed for array results: a space whose flat form is not an array (Graph, Sequence, whose
flatten_space keeps them composite) is refused at construction with a TypeError rather
than returning a non-array observation.
Reference: gymnasium/wrappers/transform_observation.py.
Constructors
FlattenObservation(Env<TObs, TAct>)
Wraps env.
public FlattenObservation(Env<TObs, TAct> env)
Parameters
envEnv<TObs, TAct>The env.
Exceptions
FlattenObservation(Env<TObs, TAct>, FlattenObservationOptions)
Builds the instance from its options record: the properties set, the constructor's defaults for the rest.
public FlattenObservation(Env<TObs, TAct> env, FlattenObservationOptions options)
Parameters
envEnv<TObs, TAct>The env to wrap.
optionsFlattenObservationOptionsThe options.
Exceptions
- ArgumentNullException
Thrown when
optionsis null.