flatten_spaces

class maze.perception.perception_utils.flatten_spaces(spaces: Iterable[Dict[str, torch.Tensor]])

Merges an iterable of dictionary spaces (usually observations or actions from subsequent sub-steps) into a single dictionary containing all the items.

If one key is present in multiple elements, its value will be present only once in the resulting dictionary, and all values for such key will be checked for a match.

Param

Iterable of dictionary spaces (usually observations or actions from subsequent sub-steps).

Returns

One flat dictionary, containing all keys and values form the elements of the iterable.