stack_and_flatten_spaces(input_tensor_dict: Iterable[Dict[str, torch.Tensor]], observation_spaces_dict: Dict[Union[str, int], gym.spaces.Dict])¶
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, all its values will be concatenated in the resulting dictionary.
input_tensor_dict – Iterable of dictionary spaces (usually observations or actions from subsequent sub-steps).
observation_spaces_dict – The full observation_spaces dict to use in order to infer the concatenation dimension
One flat dictionary, containing all keys and values form the elements of the iterable.