
    `i                     R    d dl Z d dlZd dlmZ dej        deej                 fdZdS )    N)is_traceable_wrapper_subclasstreturnc                    | g}t                      }t          |          dk    r|                                t                    r9                                \  }}|                    fd|D                        ndt          d          s-t          j        dt                     t          d           n'|                                                               t          |          dk    |S )z
    Recursively extracts untyped storages from a tensor or its subclasses.

    Args:
        t (torch.Tensor): The tensor to extract storages from.

    Returns:
        Set[torch.UntypedStorage]: A set of untyped storages.
    r   c                 0    g | ]}t          |          S  )getattr).0attrobjs     y/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torch/distributed/_tools/common_utils.py
<listcomp>z(get_untyped_storages.<locals>.<listcomp>   s#    'M'M'MtT(:(:'M'M'M    untyped_storagezEExpected a tensor or a traceable wrapper-subclass of tensor, but got    )category
stacklevel)setlenpopr   __tensor_flatten__extendhasattrwarningswarntypeUserWarningaddr   )r   unflattened_tensorsflattened_tensor_storagesattrs_r   s        @r   get_untyped_storagesr#      s    # #
!
"
"Q
&
&!%%''(-- 	E--//HE1&&'M'M'M'Mu'M'M'MNNNN3 122 Eg\`ad\e\egg(      *--c.A.A.C.CDDD !
"
"Q
&
& %$r   )r   torchtorch.utils._python_dispatchr   Tensorr   UntypedStorager#   r   r   r   <module>r(      s_      F F F F F F%EL %S1E-F % % % % % %r   