malib.utils.preprocessor module

class malib.utils.preprocessor.BoxFlattenPreprocessor(space: gym.spaces.box.Box)[source]

Bases: malib.utils.preprocessor.Preprocessor

property shape
property size
transform(data, nested=False) numpy.ndarray[source]

Transform original data to feet the preprocessed shape. Nested works for nested array.

write(array, offset, data)[source]
class malib.utils.preprocessor.BoxStackedPreprocessor(space: gym.spaces.box.Box)[source]

Bases: malib.utils.preprocessor.Preprocessor

property shape
property size
transform(data, nested=False) numpy.ndarray[source]

Transform original data to feet the preprocessed shape. Nested works for nested array.

write(array: numpy.ndarray, offset: int, data: Any)[source]
class malib.utils.preprocessor.DictFlattenPreprocessor(space: gym.spaces.dict.Dict)[source]

Bases: malib.utils.preprocessor.Preprocessor

property shape
property size
transform(data, nested=False) numpy.ndarray[source]

Transform support multi-instance input

write(array: numpy.ndarray, offset: int, data: Any)[source]
class malib.utils.preprocessor.DiscreteFlattenPreprocessor(space: gym.spaces.discrete.Discrete)[source]

Bases: malib.utils.preprocessor.Preprocessor

property shape
property size
transform(data, nested=False) numpy.ndarray[source]

Transform to one hot

write(array, offset, data)[source]
class malib.utils.preprocessor.Mode[source]

Bases: object

FLATTEN = 'flatten'
STACK = 'stack'
class malib.utils.preprocessor.Preprocessor(space: gym.spaces.space.Space)[source]

Bases: object

property observation_space
property shape
property size
abstract transform(data, nested=False) numpy.ndarray[source]

Transform original data to feet the preprocessed shape. Nested works for nested array.

abstract write(array: numpy.ndarray, offset: int, data: Any)[source]
class malib.utils.preprocessor.TupleFlattenPreprocessor(space: gym.spaces.tuple.Tuple)[source]

Bases: malib.utils.preprocessor.Preprocessor

property shape
property size
transform(data, nested=False) numpy.ndarray[source]

Transform original data to feet the preprocessed shape. Nested works for nested array.

write(array: numpy.ndarray, offset: int, data: Any)[source]
malib.utils.preprocessor.get_preprocessor(space: gym.spaces.space.Space, mode: str = 'flatten')[source]