o
     ݱi                     @   sF   d dl mZ d dlZdeeejf deeeeejf f fddZdS )    )UnionNxreturnc                 C   st   i }g }|   D ]#\}}|dr+|dd }||vs"J d| |||< || q|D ]}| |= q.|| d< | S )a  
    Unflattens entries with keys starting with "obs" as follows:

        dict_data["obs.some_name"] -> dict_data["obs"]["some_name"]

    Args:
        x: A dictionary of tensors.

    Returns:
        The same dictionary, but keys starting with "obs" are unflattened.
    zobs.   NzDuplicate key obs)items
startswithappend)r   r   	to_deletekeyvaluenew_key r   D/data/cameron/vidgen/unified-world-model/datasets/utils/obs_utils.pyunflatten_obs   s   

r   )typingr   torchdictstrTensorr   r   r   r   r   <module>   s    2