§
    Ì²Åjf  ã            	       ó6  — d dl Z d dlZd dlZd dlmZ d dlmZmZmZm	Z	m
Z
mZmZ d dlmZ d dlmZmZ ddgZeeef         Zeee
edf         f         Zd	„ Zd
edede	e         dee         fd„Zdedefd„Zddedee         defd„Zdedede	e         defd„ZdS )é    N)Ú
Collection)ÚDictÚListÚOptionalÚSetÚTupleÚTypeÚUnion)Údill_available)ÚIterDataPipeÚMapDataPipeÚtraverseÚtraverse_dpsÚDataPipeGraphc                  ó   — dS )NÚSTUB© r   ó    úGC:\Projects\Historical\venv\Lib\site-packages\torch/utils/data/graph.pyÚ_stub_unpicklerr      s   € Øˆ6r   Úscan_objÚonly_datapipeÚcacheÚreturnc                 ó@  ‡ ‡‡— t          j        ¦   «         }t          j        |¦  «        }t	          ¦   «         rddlm}  ||¦  «        }nd }g Šd„ }ˆˆˆ fd„}t          t          f}		 |	D ].}
|
                     |¦  «         |r|
 	                    |¦  «         Œ/	 | 
                    ‰ ¦  «         nG# t          j        t          t          f$ r( t	          ¦   «         r| 
                    ‰ ¦  «         n‚ Y nw xY w|	D ].}
|
                     d ¦  «         |r|
 	                    d ¦  «         Œ/t	          ¦   «         rddlm}  |d¦  «         nV# |	D ].}
|
                     d ¦  «         |r|
 	                    d ¦  «         Œ/t	          ¦   «         rddlm}  |d¦  «         w w xY w‰S )Nr   )ÚPicklerc                 óº  — d }t          | t          ¦  «        rDi }|                      ¦   «         D ],\  }}t          |t          t          t
          f¦  «        r|||<   Œ-nt          | t          t          f¦  «        r?g }| D ]9}t          |t          t          t
          f¦  «        r|                     |¦  «         Œ:n$t          | t          t          t
          f¦  «        r| }|S ©N)	Ú
isinstanceÚdictÚitemsr   r   r   ÚtupleÚlistÚappend)Ú	ori_stateÚstateÚkÚvs       r   Úgetstate_hookz0_list_connected_datapipes.<locals>.getstate_hook'   sâ   € ØˆÝ�i¥Ñ&Ô&ð 	ØˆEØ!ŸšÑ)Ô)ð !ð !‘��1Ý˜a¥,µ½ZÐ!HÑIÔIð !Ø �E˜!‘Høð!õ ˜	¥E­4 =Ñ1Ô1ð 	ØˆEØð $ð $�Ý˜a¥,µ½ZÐ!HÑIÔIð $Ø—L’L ‘O”O�Oøð$õ ˜	¥Lµ+½zÐ#JÑKÔKð 	ØˆEØˆr   c                 óÀ   •— | ‰k    st          | ¦  «        ‰v rt          ‚‰                     | ¦  «         ‰                     t          | ¦  «        ¦  «         t          dfS )Nr   )ÚidÚNotImplementedErrorr$   Úaddr   )Úobjr   Úcaptured_connectionsr   s    €€€r   Úreduce_hookz._list_connected_datapipes.<locals>.reduce_hook7   sY   ø€ Ø�(Š?ˆ?�b ™gœg¨Ð.Ð.Ý%Ð%à ×'Ò'¨Ñ,Ô,Ð,à�IŠI•b˜‘g”gÑÔÐÝ" BÐ&Ð&r   )ÚextendF)ÚioÚBytesIOÚpickler   r   Údillr   r   Úset_reduce_ex_hookÚset_getstate_hookÚdumpÚPickleErrorÚAttributeErrorÚ	TypeErrorr1   )r   r   r   ÚfÚpÚdill_PicklerÚdr)   r0   Údatapipe_classesÚclsÚdill_extendr/   s   ` `         @r   Ú_list_connected_datapipesrC      sL  øøø€ õ 	Œ
‰Œ€AÝŒØ	ñ	ô 	€Aõ ÑÔð Ø0Ð0Ð0Ð0Ð0Ð0àˆL˜‰OŒOˆˆàˆàÐðð ð ð 'ð 'ð 'ð 'ð 'ð 'ð 'õ 0<½[Ð.IÐðØ#ð 	5ð 	5ˆCØ×"Ò" ;Ñ/Ô/Ð/Øð 5Ø×%Ò% mÑ4Ô4Ð4øð	Ø�FŠF�8ÑÔÐÐøÝÔ"¥NµIÐ>ð 	ð 	ð 	ÝÑÔð Ø—’�xÑ Ô Ð Ð àð !Ð ð	øøøð $ð 	,ð 	,ˆCØ×"Ò" 4Ñ(Ô(Ð(Øð ,Ø×%Ò% dÑ+Ô+Ð+øÝÑÔð 	Ø2Ð2Ð2Ð2Ð2Ð2àˆK˜ÑÔÐøøð $ð 	,ð 	,ˆCØ×"Ò" 4Ñ(Ô(Ð(Øð ,Ø×%Ò% dÑ+Ô+Ð+øÝÑÔð 	Ø2Ð2Ð2Ð2Ð2Ð2àˆK˜ÑÔÐÐð	øøøð  Ðs2   Á(1E ÂB0 Â/E Â0AC4Ã1E Ã3C4Ã4E ÅAFÚdatapipec                 óB   — t          ¦   «         }t          | d|¬¦  «        S )aí  
    Traverse the DataPipes and their attributes to extract the DataPipe graph.

    This only looks into the attribute from each DataPipe that is either a
    DataPipe and a Python collection object such as ``list``, ``tuple``,
    ``set`` and ``dict``.

    Args:
        datapipe: the end DataPipe of the graph
    Returns:
        A graph represented as a nested dictionary, where keys are ids of DataPipe instances
        and values are tuples of DataPipe instance and the sub-graph
    T)r   r   )ÚsetÚ_traverse_helper)rD   r   s     r   r   r   Z   s"   € õ ‘e”e€EÝ˜H°DÀÐFÑFÔFÐFr   c                 óŽ   — d}|s|dz  }t          j        |t          ¦  «         |€d}t          ¦   «         }t	          | ||¦  «        S )a6  
    Traverse the DataPipes and their attributes to extract the DataPipe graph.

    [Deprecated]
    When ``only_dataPipe`` is specified as ``True``, it would only look into the
    attribute from each DataPipe that is either a DataPipe and a Python collection object
    such as ``list``, ``tuple``, ``set`` and ``dict``.

    Note:
        This function is deprecated. Please use `traverse_dps` instead.

    Args:
        datapipe: the end DataPipe of the graph
        only_datapipe: If ``False`` (default), all attributes of each DataPipe are traversed.
          This argument is deprecating and will be removed after the next release.
    Returns:
        A graph represented as a nested dictionary, where keys are ids of DataPipe instances
        and values are tuples of DataPipe instance and the sub-graph
    zV`traverse` function and will be removed after 1.13. Please use `traverse_dps` instead.zM And, the behavior will be changed to the equivalent of `only_datapipe=True`.NF)ÚwarningsÚwarnÚFutureWarningrF   rG   )rD   r   Úmsgr   s       r   r   r   l   sZ   € ð*	-ð ð ð _ØÐ^Ñ^ˆÝ„M�#•}Ñ%Ô%Ð%ØÐØˆÝ‘e”e€EÝ˜H m°UÑ;Ô;Ð;r   c           	      ó²  — t          | t          t          f¦  «        s t          dt	          | ¦  «        › d�¦  «        ‚t          | ¦  «        }||v ri S |                     |¦  «         t          | ||                     ¦   «         ¦  «        }|| i fi}|D ]D}||         d          	                    t          |||                     ¦   «         ¦  «        ¦  «         ŒE|S )Nz.Expected `IterDataPipe` or `MapDataPipe`, but z	 is foundé   )r   r   r   ÚRuntimeErrorÚtyper+   r-   rC   ÚcopyÚupdaterG   )rD   r   r   Údp_idr!   r?   Úitems          r   rG   rG   Ž   sá   € õ �h¥­{Ð ;Ñ<Ô<ð 
ÝØV½TÀ(¹^¼^ÐVÐVÐVñ
ô 
ð 	
õ ˆx‰LŒL€EØ�€~€~Øˆ	Ø	‡I‚IˆeÑÔÐå% h°¸u¿zºz¹|¼|ÑLÔL€EØ ¨"˜~Ð.€AØð Pð Pˆð 	
ˆ%Œ�Œ×ÒÕ+¨D°-ÀÇÂÁÄÑNÔNÑOÔOÐOÐOØ€Hr   r   )r2   r4   rI   Úcollections.abcr   Útypingr   r   r   r   r   r	   r
   Útorch.utils._import_utilsr   Ú#torch.utils.data.datapipes.datapiper   r   Ú__all__ÚDataPipeÚintr   r   ÚboolrC   r   r   rG   r   r   r   ú<module>r]      s·  ðà 	€	€	€	Ø €€€Ø €€€Ø &Ð &Ð &Ð &Ð &Ð &Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ Ið �~Ð
&€à�˜{Ð*Ô+€Ø�S˜% ¨/Ð 9Ô:Ð:Ô;€ðð ð ð
@ Øð@ Ø'+ð@ Ø47¸´Hð@ à	ˆ(„^ð@ ð @ ð @ ð @ ðFG˜8ð G¨ð Gð Gð Gð Gð$<ð <�xð <°¸´ð <È-ð <ð <ð <ð <ðDØðØ'+ðØ47¸´Hðàðð ð ð ð ð r   