+
    ˜°³j›Á  ã                  ó¸  € ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
HtHt ^ RIt^ RIHtHtHtHtHtHt ^ RIHt ^ RIHt ]'       d   ^ RIHt ^ RIHt ^ R	IHt ]R
] 3,          t!]R] 3,          t"]PF                  ! ]$4      t% ! R R]PL                  4      t']'PP                  R]'PR                  R]'PT                  R]'PV                  R]'PX                  R]'PZ                  R]'P\                  RRR/t/]0! ]/4       U Uu/ uF  w  rWbK	  	  upp t1 ! R R]PL                  4      t2]2 U u/ uF  q V Pf                  bK  	  up t4]Pj                  ! RRRR7       ! R R
4      4       t6]Pj                   ! R R4      4       t7]Pj                  ! RRRR7       ! R R]64      4       t8R R  lt9R! R" lt:R# R$ lt;R% R& lt< ! R' R(4      t= ! R) R*4      t> ! R+ R,4      t?]Pj                  ! 4        ! R- R.4      4       t@ ! R/ R04      tA ! R1 R24      tB]Pj                   ! R3 R44      4       tC]Pj                   ! R5 R64      4       tD ! R7 R84      tE ! R9 R:4      tFR# u upp i u up i );é    )ÚannotationsN)ÚAnyÚcastÚLiteralÚTYPE_CHECKING)Ú
_EventTypeÚ_ExtraFields_AllocationÚ_ExtraFields_TorchOpÚ_ProfilerEventÚ_TensorMetadataÚRecordScope)Ú_element_size)Ú_utils)ÚIterator)ÚFunctionSchema)Ú_ProfilerResultÚKeyÚ	TensorKeyc                  ó  € ] tR t^%t]P
                  ! 4       t]P
                  ! 4       t]P
                  ! 4       t]P
                  ! 4       t	]P
                  ! 4       t
]P
                  ! 4       t]P
                  ! 4       tRtR# )ÚCategory© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚenumÚautoÚINPUTÚ	TEMPORARYÚ
ACTIVATIONÚGRADIENTÚAUTOGRAD_DETAILÚ	PARAMETERÚOPTIMIZER_STATEÚ__static_attributes__r   ó    Ú`/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/profiler/_memory_profiler.pyr   r   %   sO   † Ø�IŠI‹K€EØ—	’	“€IØ—’“€JØ�yŠy‹{€HØ—i’i“k€OØ—	’	“€IØ—i’i“k„Or&   r   Ú	darkgreenÚ	goldenrodÚblackÚmediumpurpleÚredÚ
mediumblueÚ	royalblueÚgreyc                  óž   € ] tR t^=t]P
                  ! 4       t]P
                  ! 4       t]P
                  ! 4       t]P
                  ! 4       t	Rt
R# )ÚActionr   N)r   r   r   r   r   r   ÚPREEXISTINGÚCREATEÚINCREMENT_VERSIONÚDESTROYr%   r   r&   r'   r1   r1   =   s/   † Ø—)’)“+€KØ�YŠY‹[€FØŸ	š	›ÐØ�iŠi‹k„Gr&   r1   TF)ÚeqÚunsafe_hashÚfrozenc                  ó"   € ] tR t^Gt$ R]R&   RtR# )r   útorch.deviceÚdevicer   N)r   r   r   r   Ú__annotations__r%   r   r&   r'   r   r   G   s   ‡ à×r&   c                  óT   € ] tR t^Lt$ RtR]R&   R]R&   R R ltR R ltR	 R
 ltRt	R# )Ú_StoragezåBundle storage pointer and id.

All profiling logic should use `allocation_id`, however it is useful to
print storage pointers for debugging and unit tests sometimes look up
values using the storage data pointer of a live Tensor.ÚintÚptrÚallocation_idc               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚstrr   )Úformats   "r'   Ú__annotate__Ú_Storage.__annotate__W   s   € ÷ =ñ =˜#ñ =r&   c                	óN   € \        V P                  4      R  RV P                   R2# )z>18ú (Ú))Úhexr@   rA   ©Úselfs   &r'   Ú__repr__Ú_Storage.__repr__W   s'   € Ü�d—h‘h“- Ð$ B t×'9Ñ'9Ð&:¸!Ð<Ð<r&   c               ó    € V ^8„  d   QhRRRR/# )rD   ÚotherÚobjectrE   Úboolr   )rG   s   "r'   rH   rI   Z   s   € ÷ Yñ Y˜Fð Y tñ Yr&   c                	ód   € \        V\        4      ;'       d    V P                  VP                  8H  # ©N)Ú
isinstancer>   rA   ©rO   rS   s   &&r'   Ú__eq__Ú_Storage.__eq__Z   s(   € Ü˜%¤Ó*×XÐX¨t×/AÑ/AÀU×EXÑEXÑ/XÐXr&   c               ó   € V ^8„  d   QhRR/# ©rD   rE   r?   r   )rG   s   "r'   rH   rI   ]   s   € ÷ (ñ (˜#ñ (r&   c                	ó,   € \        V P                  4      # rW   )ÚhashrA   rN   s   &r'   Ú__hash__Ú_Storage.__hash__]   s   € Ü�D×&Ñ&Ó'Ð'r&   r   N)
r   r   r   r   Ú__doc__r<   rP   rZ   r`   r%   r   r&   r'   r>   r>   L   s)   ‡ ñ?ð 
ƒHØÓõ=õY÷(ñ (r&   r>   c                  ó    € ] tR t^at$ RtR]R&   R]R&   R R ltR R	 lt]R
 R l4       t	]
R R l4       t]
R R l4       t]R R l4       tRtR# )r   ag  Hashable identifier for a storage which has been assigned an ID.

A detailed description of Tensor IDs and why they are needed is given in
`torch/csrc/profiler/collection.h` when `TensorID` is declared. To
summarize, multiple Storage buffers can map to the same logical Tensor.
This dataclass is used to refer to a concrete in-memory StorageImpl of
a Tensor.
r?   Úidr>   Ústoragec               ó   € V ^8„  d   QhRR/# rC   r   )rG   s   "r'   rH   ÚTensorKey.__annotate__o   s   € ÷ Iñ I˜#ñ Ir&   c                	ój   € R V P                    R\        V P                  4      R RV P                   R2# )zid=z: z<24rK   rL   )rd   Úreprre   r;   rN   s   &r'   rP   ÚTensorKey.__repr__o   s1   € Ø�T—W‘W�I˜R¤ T§\¡\Ó 2°3Ð7°r¸$¿+¹+¸ÀaÐHÐHr&   c               ó    € V ^8„  d   QhRRRR/# )rD   rS   r   rE   rU   r   )rG   s   "r'   rH   rg   r   s   € ÷ 6ñ 6˜Ið 6¨$ñ 6r&   c                	ó4   € V P                   VP                   8  # rW   )Ú_as_sortablerY   s   &&r'   Ú__lt__ÚTensorKey.__lt__r   s   € Ø× Ñ  5×#5Ñ#5Ñ5Ð5r&   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	rD   Ú	tensor_idú
int | NoneÚstorage_ptrrA   r;   r:   rE   úTensorKey | Noner   )rG   s   "r'   rH   rg   v   s:   € ÷ ñ Øðàðð "ðð ð	ð
 
ñr&   c                	óH   € V e   Ve   Ve   \        W0\        W4      4      # R # rW   )r   r>   )rq   rs   rA   r;   s   &&&&r'   Ú_makeÚTensorKey._makeu   s+   € ð Ò!ØÒ'ØÒ)ä˜V´¸Ó0TÓUÐUÙr&   c               ó    € V ^8„  d   QhRRRR/# )rD   Úallocr	   rE   rt   r   )rG   s   "r'   rH   rg   …   s    € ÷ Qñ QÐ$;ð QÐ@Pñ Qr&   c                	óz   € V P                  VP                  VP                  VP                  VP                  4      # rW   )rv   rd   r@   rA   r;   )Úclsry   s   &&r'   Úfrom_allocationÚTensorKey.from_allocation„   s)   € à�y‰y˜Ÿ™ 5§9¡9¨e×.AÑ.AÀ5Ç<Á<ÓPÐPr&   c               ó    € V ^8„  d   QhRRRR/# )rD   Útú_TensorMetadata | NonerE   rt   r   )rG   s   "r'   rH   rg   ‰   s   € ÷ ñ Ð2ð Ð7Gñ r&   c                	ó†   € Ve=   V P                  VP                  VP                  VP                  VP                  4      # R # rW   )rv   rd   Ústorage_data_ptrrA   r;   )r{   r   s   &&r'   Úfrom_tensorÚTensorKey.from_tensorˆ   s1   € àŠ=Ø—9‘9˜QŸT™T 1×#5Ñ#5°q·±ÈÏÉÓQÐQÙr&   c               ó   € V ^8„  d   QhRR/# )rD   rE   ztuple[int, int, str, int]r   )rG   s   "r'   rH   rg   �   s   € ÷ Xñ XÐ7ñ Xr&   c                	óš   € V P                   V P                  P                  V P                  P                  V P                  P
                  3# rW   )rd   re   rA   r;   ÚtypeÚindexrN   s   &r'   rm   ÚTensorKey._as_sortableŽ   s3   € à�w‰w˜Ÿ™×2Ñ2°D·K±K×4DÑ4DÀdÇkÁk×FWÑFWÐWÐWr&   r   N)r   r   r   r   rb   r<   rP   rn   Ústaticmethodrv   Úclassmethodr|   rƒ   Úpropertyrm   r%   r   r&   r'   r   r   a   ss   ‡ ñð 	ƒGØÓõIõ6ð ôó ðð ôQó ðQð ôó ðð
 ôXó ôXr&   c               ó    € V ^8„  d   QhRRRR/# )rD   Únoder   rE   z3Iterator[tuple[TensorKey | None, TensorKey | None]]r   )rG   s   "r'   rH   rH   “   s    € ÷ (Nñ (NØ
ð(Nà8ñ(Nr&   c              #  ó  "  € V P                   pV P                  ^ ,          \        P                  8X  Ed=   V P                  ^,          P                  \
        P                  8X  Ed   V P                  R8X  dû   V'       dó   V^ ,          P                  ^ ,          \        P                  8X  dÆ   V^ ,          P                  R9   d®   V^ ,          P                  ^,          P                  '       d„   \        V^ ,          P                  ^,          P                  ^ ,          \        4      '       dE   R\        P                  V^ ,          P                  ^,          P                  ^ ,          4      3x € R# V P                  ^ ,          \        P                  8X  dó   V P                  ^,          pVP                  e   VP                  e   \!        R4      hVP                  eM   VP                  P"                   F2  w  r4p\        P                  V4      \        P                  V4      3x € K4  	  VP                  eO   VP                  P"                   F2  w  rEp\        P                  V4      \        P                  V4      3x € K4  	  R# R# R# 5i)r   ztorch::autograd::AccumulateGradNú'module and optimizer cannot both be set)zaten::detachz
aten::add_)ÚchildrenÚtypedr   ÚTorchOpÚscoper   ÚBACKWARD_FUNCTIONÚnameÚinputsrX   r   r   rƒ   ÚPyCallÚmoduleÚ	optimizerÚAssertionErrorÚ
parameters)rŽ   r‘   Útyped_fieldsÚ_ÚpÚp_grads   &     r'   Ú!_extract_parameters_and_gradientsr¡   “   sÙ  é € ð �}‰}€Hð 	�
‰
�1�œ×+Ñ+Õ+Ø�J‰J�q�M×Ñ¤;×#@Ñ#@Õ@à�I‰IÐ:Ô:ßØ�Q�K×Ñ˜aÕ ¤J×$6Ñ$6Ô6Ø�Q�K×ÑÐ >Ô>Ø�Q�K×Ñ˜aÕ ×'×'Ð'Ü�x •{×(Ñ(¨Õ+×2Ñ2°1Õ5´×GÒGà”I×)Ñ)¨(°1­+×*;Ñ*;¸AÕ*>×*EÑ*EÀaÕ*HÓIÐIÔIð 
�‰�A�œ*×+Ñ+Ô	+Ø—z‘z !•}ˆØ×ÑÒ*¨|×/EÑ/EÒ/QÜ Ð!JÓKÐKØ×ÑÒ*Ø ,× 3Ñ 3× >Ô >‘��fÜ×+Ñ+¨AÓ.´	×0EÑ0EÀfÓ0MÐMÔMñ !?ð ×!Ñ!Ò-Ø ,× 6Ñ 6× AÔ A‘�˜1Ü×+Ñ+¨AÓ.´	×0EÑ0EÀfÓ0MÐMÔMó !Bñ .ñ 
,ùs   ‚A=JÂ A.JÃ/FJc               ó    € V ^8„  d   QhRRRR/# )rD   rŽ   r   rE   zIterator[TensorKey]r   )rG   s   "r'   rH   rH   ¾   s   € ÷ ñ ˜^ð Ð0Cñ r&   c              #  óJ   "  € \        V 4       F  w  rVf   K  Vx € K  	  R # 5irW   ©r¡   )rŽ   rŸ   Ú_p_grads   &  r'   Úextract_parametersr¦   ¾   s    é € Ü7¸Ö=‰
ˆØŒ=ØŒGó >ùs   ‚#™
#c               ó    € V ^8„  d   QhRRRR/# )rD   rŽ   r   rE   z,Iterator[tuple[TensorKey | None, TensorKey]]r   )rG   s   "r'   rH   rH   Ä   s   € ÷ ñ Ø
ðà1ñr&   c              #  óL   "  € \        V 4       F  w  rVf   K  W3x € K  	  R # 5irW   r¤   )rŽ   rŸ   r    s   &  r'   Úextract_gradientsr©   Ä   s%   é € ô 7°tÖ<‰	ˆØÔØ�)ŒOó =ùs   ‚$™$c               ó    € V ^8„  d   QhRRRR/# )rD   Úeventz_ProfilerEvent | NonerE   ztuple[RecordScope, ...]r   )rG   s   "r'   rH   rH   Ì   s   € ÷ ñ Ð+ð Ð0Gñ r&   c                óì   € . pV '       da   V P                   ^ ,          \        P                  8X  d-   VP                  V P                   ^,          P                  4       V P
                  p Kh  \        V4      # ©r   )r’   r   r“   Úappendr”   ÚparentÚtuple)r«   Úscopess   & r'   Ú
get_scopesr²   Ì   sM   € Ø€Fß
Ø�;‰;�q�>œZ×/Ñ/Ô/Ø�M‰M˜%Ÿ+™+ a�.×.Ñ.Ô/Ø—‘ŠÜ�‹=Ðr&   c                  ór   € ] tR t^ÕtRt]R R l4       t]R R l4       t]R R l4       t]	R R	 l4       t
R
tR# )ÚSchemaMatcheraÒ  Lookup operator schema based on profiled name.

When profiling we record the operator's name but not the schema. However
some analysis requires that information. Fortunately we can look up
registered schema from the recorded name. We do not, however, record the
overload and so we must compare the profiled arguments with all overloads
to determine viable matches.

Note: Once https://github.com/pytorch/pytorch/issues/78871 is completed
this code will be obsolete.
c               ó    € V ^8„  d   QhRRRR/# )rD   r   r
   rE   ztuple[bool | None, ...]r   )rG   s   "r'   rH   ÚSchemaMatcher.__annotate__ã   s   € ÷ :ñ :Ð#7ð :Ð<Sñ :r&   c           
     óf  € RpV P                  V4       Fp  pT;'       g    VP                   Uu. uF  pRNK  	  upp\        VP                  4       F.  w  rVW%;;,          \        VP                  RR4      ,          uu&   K0  	  Kr  	  \        T;'       g    R VP                   4       4      # u upi )a  Determine which inputs may have mutated based on function schema.

Note that we don't need to resolve down to a single schema to perform
this analysis. An input is mutable if it is mutable in any overload. In
practice, however, it is overwhelmingly common to match a single
overload. If we cannot find any valid schema then we must be
conservative and assume all inputs are mutable.
NFÚis_writec              3  ó&   "  € T F  pR x € K	  	  R # 5irW   r   )Ú.0rž   s   & r'   Ú	<genexpr>Ú3SchemaMatcher.inputs_are_mutable.<locals>.<genexpr>ó   s   é € Ð 8©x¨!¥«xùs   ‚)Úmatch_schemasÚ	argumentsÚ	enumerateÚgetattrÚ
alias_infor°   r—   )r{   r   ÚmutableÚschemarž   ÚiÚargs   &&     r'   Úinputs_are_mutableÚ SchemaMatcher.inputs_are_mutableâ   s—   € ð &*ˆØ×'Ñ'¨Ö*ˆFØ×BÐB°×1AÒ1AÓ!BÑ1A¨A£%Ñ1AÑ!BˆGÜ# F×$4Ñ$4Ö5‘�à—
œg c§n¡n°jÀ%ÓHÕH•
ó 6ñ +ô �W×8Ð8Ñ 8¨q¯xªxÓ 8Ó9Ð9ùò "Cs   ¯B.c               ó    € V ^8„  d   QhRRRR/# )rD   r   r
   rE   ztuple[FunctionSchema, ...]r   )rG   s   "r'   rH   r¶   ö   s    € ÷ Pñ PÐ2ð PÐ7Qñ Pr&   c                	óŒ  a aa€ \         ;QJ d    . R  VP                   4       F  NK  	  5M! R  VP                   4       4      oR V V3R llo\         ;QJ d:    . V3R lS P                  VP                  4      ;'       g    R 4       F  NK  	  5# ! V3R lS P                  VP                  4      ;'       g    R 4       4      # )c              3  óü   "  € T Fm  p\        V\        4      '       d   \        P                  V4      M<\        V\        4      '       d&   V Uu. uF  p\        P                  V4      NK  	  upMTx € Ko  	  R # u upi 5irW   )rX   r   r   rƒ   Úlist©rº   rÄ   Újs   &  r'   r»   Ú.SchemaMatcher.match_schemas.<locals>.<genexpr>÷   sr   é € ð 
ñ �ô ˜!œ_×-Ò-ô ×!Ñ! !Ô$ô
 ˜!œT×"Ò"ñ 56Ó6±A¨q”)×'Ñ'¨Ö*±AÒ6ð ôó ùò 7ùs   ‚A
A<ÁA7Á*A<c               ó   € V ^8„  d   QhRR/# ©rD   rE   rU   r   )rG   s   "r'   rH   Ú1SchemaMatcher.match_schemas.<locals>.__annotate__  s   € ÷ 	ñ 	˜tñ 	r&   c           	     ó"  <€ \        V P                  4      \        S4      8H  ;'       dg    \        ;QJ d5    V3R  l\        SV P                  RR7       4       F  '       d   K   R# 	  R# ! V3R  l\        SV P                  RR7       4       4      # )c              3  ó^   <"  € T F"  w  rSP                  WP                  4      x € K$  	  R # 5irW   )Ú_types_matchr‡   )rº   ÚobservedÚ
schema_argr{   s   &  €r'   r»   Ú?SchemaMatcher.match_schemas.<locals>.matches.<locals>.<genexpr>  s2   øé € ð Cñ-Ñ(�Hð × Ñ  ¯?©?×;Ð;ó-ùs   ƒ*-T©ÚstrictF)Úlenr¾   ÚallÚzip)rÃ   r{   Ú	signatures   &€€r'   ÚmatchesÚ,SchemaMatcher.match_schemas.<locals>.matches  s‡   ø€ Ü�v×'Ñ'Ó(¬C°	«NÑ:÷ ð ¿s»sô Cä,/Ø˜v×/Ñ/¸õ-óC¿s¼sð ºsð ¸sô Cä,/Ø˜v×/Ñ/¸õ-óCó @ð r&   c              3  óH   <"  € T F  pS! V4      '       g   K  Vx € K  	  R # 5irW   r   )rº   ÚsrÞ   s   & €r'   r»   rÎ     s   øé € ÐOÑ @˜1ÁGÈAÇJ—Q’QÓ @ùs   ƒ"˜
"r   )r°   r—   Úlookup_schemasr–   )r{   r   rÞ   rÝ   s   f&@@r'   r½   ÚSchemaMatcher.match_schemasõ   s›   ú€ ç”Eñ 
ð —X’Xó
—E‘Eñ 
ð —X’Xó
ó 
ˆ	÷	ñ 	÷ ŒuÔO × 2Ñ 2°1·6±6Ó :× @Ð @¸bÐ @ÓO�uÐOˆuÔO × 2Ñ 2°1·6±6Ó :× @Ð @¸bÐ @ÓOÓOÐOr&   c               ó   € V ^8„  d   QhRR/# rÐ   r   )rG   s   "r'   rH   r¶     s   € ÷  ñ  °Dñ  r&   c                	óT  € \        V\        P                  P                  4      '       d.   VP	                  4       pVR J ;'       g    V P                  W4      # \        V\        P                  P                  4      '       d   R# VP                  \        P                  P                  P                  4       4      '       dM   \        V\        4      ;'       d5    \        ;QJ d    R V 4       F  '       d   K   R# 	  R# ! R V 4       4      # \        P                  P                  \        3\        P                  P                  \        R 4      3\        P                  P                   \"        3\        P                  P$                  \&        3\        P                  P(                  \*        3\        P                  P,                  \.        3\        P                  P0                  \"        \&        \*        \.        333pV F#  w  rE\        W$4      '       g   K  \        W4      u # 	  VR J # )NTc              3  óB   "  € T F  p\        V\        4      x € K  	  R # 5irW   )rX   r   ©rº   rÄ   s   & r'   r»   Ú-SchemaMatcher._types_match.<locals>.<genexpr>  s   é € ð 6Ù2:¨Q”
˜1œi×(Ð(³(ùs   ‚F)rX   ÚtorchÚ_CÚOptionalTypeÚgetElementTyperÔ   ÚAnyTypeÚisSubtypeOfÚListTypeÚ	ofTensorsrË   rÛ   Ú
TensorTyper   ÚNoneTyper‡   ÚBoolTyperU   ÚIntTyper?   Ú	FloatTypeÚfloatÚComplexTypeÚcomplexÚ
NumberType)r{   rÕ   Úschema_typeÚtype_mapÚjit_typeÚpy_typess   &&&   r'   rÔ   ÚSchemaMatcher._types_match  s˜  € ä�k¤5§8¡8×#8Ñ#8×9Ò9Ø%×4Ñ4Ó6ˆKØ˜tÐ#×NÐN s×'7Ñ'7¸Ó'NÐNä�k¤5§8¡8×#3Ñ#3×4Ò4Ùà×"Ñ"¤5§8¡8×#4Ñ#4×#>Ñ#>Ó#@×AÒAÜ˜h¬Ó-÷ ð ·#³#ñ 6Ù2:ó6·#´#ð ²#ð °#ñ 6Ù2:ó6ó 3ð ô
 �X‰X× Ñ ¤)Ð,Ü�X‰X×Ñ¤ T£
Ð+Ü�X‰X×Ñ¤Ð%Ü�X‰X×ÑœsÐ#Ü�X‰X×Ñ¤Ð'Ü�X‰X×!Ñ!¤7Ð+Ü�X‰X× Ñ ¤4¬¬e´WÐ"=Ð>ðE
ˆó #+ÑˆHÜ˜+×0Ô0Ü! (Ó5Ò5ñ #+ð ˜4ÐÐr&   c               ó    € V ^8„  d   QhRRRR/# )rD   r–   rF   rE   z!tuple[FunctionSchema, ...] | Noner   )rG   s   "r'   rH   r¶   2  s   € ÷ ñ ˜Sð Ð%Fñ r&   c                	óŠ   €  R V 9  d   R# \        \        P                  P                  V 4      4      #   \         d     R# i ; i)z::N)r°   ré   rê   Ú_jit_get_schemas_for_operatorÚRuntimeError)r–   s   &r'   râ   ÚSchemaMatcher.lookup_schemas1  s@   € ð	ð ˜4ÔÙÜœŸ™×?Ñ?ÀÓEÓFÐFøÜô 	Úð	ús   ‚3 ‹'3 ³AÁAr   N)r   r   r   r   rb   r‹   rÆ   r½   rÔ   rŠ   râ   r%   r   r&   r'   r´   r´   Õ   sZ   † ñ
ð ô:ó ð:ð$ ôPó ðPð2 ô ó ð ðB ôó ôr&   r´   c                  óD   € ] tR tRtR R ltR R lt]R R l4       tRtR	# )
ÚOpTreeiG  c               ó    € V ^8„  d   QhRRRR/# ©rD   Úresultr   rE   ÚNoner   )rG   s   "r'   rH   ÚOpTree.__annotate__H  s   € ÷ Vñ V˜ð V°4ñ Vr&   c                	ó„   € VP                  4       V n        \        \        V P	                  4       R  R7      4      V n        R# )c                ó   € V P                   # rW   ©Ústart_time_ns©Úxs   &r'   Ú<lambda>Ú!OpTree.__init__.<locals>.<lambda>J  s   € ÀAÇOÂOr&   ©ÚkeyN)Úexperimental_event_treeÚ_root_nodesr°   ÚsortedÚdfsÚ_sorted_nodes©rO   r  s   &&r'   Ú__init__ÚOpTree.__init__H  s.   € Ø!×9Ñ9Ó;ˆÔÜ"¤6¨$¯(©(«*Ñ:SÔ#TÓUˆÖr&   c               ó   € V ^8„  d   QhRR/# )rD   rE   zIterator[_ProfilerEvent]r   )rG   s   "r'   rH   r
  L  s   € ÷ Jñ JÐ&>ñ Jr&   c              /  	ój   "  € \         P                  ! V P                  .VO5/ VB  R j  x€L
  R #  L5irW   )r   Útraverse_dfsr  ©rO   ÚargsÚkwargss   &*,r'   r  Ú
OpTree.dfsL  s)   é € Ü×&Ò& t×'7Ñ'7ÐI¸$ÒIÀ&ÑI×IÔIùs   ‚(3ª1«3c               ó   € V ^8„  d   QhRR/# ©rD   rE   útuple[_ProfilerEvent, ...]r   )rG   s   "r'   rH   r
  P  s   € ÷ "ñ "Ð8ñ "r&   c                	ó   € V P                   # rW   )r  rN   s   &r'   Úsorted_nodesÚOpTree.sorted_nodesO  s   € à×!Ñ!Ð!r&   )r  r  N)	r   r   r   r   r  r  rŒ   r(  r%   r   r&   r'   r  r  G  s"   † õVõJð ô"ó ô"r&   r  c                  óP   € ] tR tRtR R ltR R lt]R R l4       tR R	 ltR
t	R# )ÚSizeMapiT  c               ó    € V ^8„  d   QhRRRR/# ©rD   Úop_treer  rE   r	  r   )rG   s   "r'   rH   ÚSizeMap.__annotate__U  s   € ÷ .)ñ .) ð .)¨4ñ .)r&   c                	óî  € / V n         VP                   EF‡  pVP                  ^ ,          \        P                  8X  d=   V P                  VP                  ^,          4       F  pV P                  V4       K  	  Kf  VP                  ^ ,          \        P                  8X  g   KŽ  VP                  ^,          pVP                  e   VP                  e   \        R4      hVP                  eC   VP                  P                   F(  w  rVpV P                  V4       V P                  V4       K*  	  VP                  f   EK)  VP                  P                   FD  w  rgpV P                  V4       V P                  V4       V F  w  rSV P                  V4       K  	  KF  	  EKŠ  	  / p	VP                   F¨  pVP                  ^ ,          \        P                  8X  g   K+  VP                  ^,          p
\        P                  V
4      pV'       g   K]  \        V
P                   4      pV	P#                  W¼4      pWÜ8w  g   K‹  V RV 2p\$        P'                  RV4       Kª  	  V P                   P)                  V	4       R# )r   Nr�   z vs. z(Mismatch between allocation and free: %s)Ú_valuesr(  r’   r   r“   Ú_flat_tensor_inputsÚ_update_valuesr˜   r™   rš   r›   rœ   Ú
Allocationr   r|   ÚabsÚ
alloc_sizeÚ
setdefaultÚlogÚwarningÚupdate)rO   r.  rŽ   r   r�   rž   rŸ   r    ÚstateÚallocationsÚalloc_fieldsr  Únew_sizeÚ
prior_sizeÚdeltas   &&             r'   r  ÚSizeMap.__init__U  sò  € Ø-/ˆŒà×(Õ(ˆDØ�z‰z˜!�}¤
× 2Ñ 2Ô2Ø×1Ñ1°$·*±*¸Qµ-Ö@�AØ×'Ñ'¨Ö*ó Að —‘˜A•¤*×"3Ñ"3Ö3Ø#Ÿz™z¨!�}�à ×'Ñ'Ò3Ø$×.Ñ.Ò:ä(Ð)RÓSÐSØ×&Ñ&Ò2Ø(4×(;Ñ(;×(FÔ(F™˜˜fØ×+Ñ+¨AÔ.Ø×+Ñ+¨FÖ3ñ )Gð  ×)Ñ)Õ5Ø,8×,BÑ,B×,MÔ,MÑ(˜ 5Ø×+Ñ+¨AÔ.Ø×+Ñ+¨FÔ3Û$)™D˜AØ ×/Ñ/°Ö2ó %*ô -Nñ% )ð0 -/ˆØ×(Ô(ˆDØ�z‰z˜!�}¤
× 5Ñ 5Ö5Ø#Ÿz™z¨!�}�Ü×/Ñ/°Ó=�ß‘3Ü" <×#:Ñ#:Ó;�HØ!,×!7Ñ!7¸Ó!F�Jð "Ö-Ø#- ,¨e°H°:Ð >˜ÜŸ™Ð$NÐPUÖVñ! )ð$ 	�‰×Ñ˜KÖ(r&   c               ó    € V ^8„  d   QhRRRR/# )rD   r   r€   rE   r	  r   )rG   s   "r'   rH   r/  …  s   € ÷ Iñ IÐ 6ð I¸4ñ Ir&   c           	     	óâ  € \         P                  V4      pVeÖ   VeÐ   VP                  \        P                  8X  d¯   \        R \        VP                  ;'       g    ^.VP                  ;'       g    ^.RR7       4       4      pV\        VP                  4      ,          pV^ 8  d   \        RV 24      h\        V P                  P                  V^ 4      V4      V P                  V&   R # R # R # R # )Nc              3  óN   "  € T F  q^ ,          V^,          ,          x € K  	  R# 5i©r   Nr   rç   s   & r'   r»   Ú)SizeMap._update_values.<locals>.<genexpr>‰  s    é € ð Ù%W �!•�q˜•t—’Ó%Wùs   ‚#%TrØ   z$num_bytes must be non-negative, got )r   rƒ   Úlayoutré   ÚstridedÚmaxrÜ   ÚsizesÚstridesr   Údtyper›   r1  Úget)rO   r   r  ÚnÚ	num_bytess   &&   r'   r3  ÚSizeMap._update_values…  sÄ   € Ü×#Ñ# AÓ&ˆØŠ?˜qš}°·±¼U¿]¹]Ô1Jäñ Ü%(¨¯©¯¨°Q°C¸¿¹×9IÐ9IÀqÀcÐRVÕ%Wóó ˆAð œM¨!¯'©'Ó2Õ2ˆIØ˜1Œ}Ü$Ð'KÈIÈ;Ð%WÓXÐXÜ # D§L¡L×$4Ñ$4°S¸!Ó$<¸iÓ HˆD�L‰L˜Óñ 2K™}‰?r&   c               ó    € V ^8„  d   QhRRRR/# )rD   Úopr
   rE   zIterator[_TensorMetadata]r   )rG   s   "r'   rH   r/  “  s   € ÷ ñ Ð 4ð Ð9Rñ r&   c              #  	ó´   "  € V P                    FA  p\        V\        4      '       d   Vx € K  \        V\        4      '       g   K7  T R j  x€L
  KC  	  R #  L
5irW   )r—   rX   r   rË   )rR  rÄ   s   & r'   r2  ÚSizeMap._flat_tensor_inputs’  s>   é € à—”ˆAÜ˜!œ_×-Ò-Ø”Ü˜Aœt×$Ô$Ø—’ó	 ñ ùs   ‚?AÁAÁAÁAc               ó   € V ^8„  d   QhRR/# )rD   r  r   r   )rG   s   "r'   rH   r/  š  s   € ÷ !ñ !˜yñ !r&   c                	ó(   € V P                   V,          # rW   ©r1  ©rO   r  s   &&r'   Ú__getitem__ÚSizeMap.__getitem__š  s   € Ø�|‰|˜CÕ Ð r&   rW  N)
r   r   r   r   r  r3  rŠ   r2  rY  r%   r   r&   r'   r+  r+  T  s,   † õ.)õ`Ið ôó ð÷!ñ !r&   r+  c                  ó`   € ] tR tRt$ RtR]R&   RtR]R&   ]R R	 l4       t]R
 R l4       t	Rt
R# )ÚDataFlowEdgeiž  Nrr   Úinput_versionFzbool | NoneÚmutatedc               ó   € V ^8„  d   QhRR/# rÐ   r   )rG   s   "r'   rH   ÚDataFlowEdge.__annotate__¤  s   € ÷ *ñ *˜tñ *r&   c                	ó   € V P                   R J # rW   )r]  rN   s   &r'   Úis_allocationÚDataFlowEdge.is_allocation£  s   € à×!Ñ! TÐ)Ð)r&   c               ó   € V ^8„  d   QhRR/# rÐ   r   )rG   s   "r'   rH   r`  ¨  s   € ÷ $ñ $˜Tñ $r&   c                	ó   € V P                   R J # rW   )r^  rN   s   &r'   Úis_deletionÚDataFlowEdge.is_deletion§  s   € à�|‰|˜tÐ#Ð#r&   r   )r   r   r   r   r]  r<   r^  rŒ   rb  rf  r%   r   r&   r'   r\  r\  ž  s<   ‡ à $€M�:Ó$Ø €Gˆ[Ó àô*ó ð*ð ô$ó ô$r&   r\  c                  ó†   € ] tR tRtR R ltR R lt]R R l4       t]R R	 l4       t]R
 R l4       t	]R R l4       t
RtR# )ÚDataFlowNodei¬  c               ó$   € V ^8„  d   QhRRRRRR/# )rD   r«   r   ÚgraphÚDataFlowGraphrE   r	  r   )rG   s   "r'   rH   ÚDataFlowNode.__annotate__­  s&   € ÷ Qñ Q˜nð Q°]ð QÀtñ Qr&   c           	     	ó’  € Wn         W n        V P                  4       V n        V P                  P	                  4        FH  w  r4VP
                  '       g   K  VP                  '       d   K-  V P                  P                  V4       KJ  	  V P                  P	                  4        UUu/ uF"  w  rVWVV P                  P                  V4      3bK$  	  ppp\        ;QJ d*    R  VP                  4        4       F  '       d   K   RM	  RM! R  VP                  4        4       4      '       g   \        RV RV P                   24      hR# u uppi )c              3  ó.   "  € T F  w  rW8H  x € K  	  R # 5irW   r   rÌ   s   &  r'   r»   Ú(DataFlowNode.__init__.<locals>.<genexpr>¸  s   é € Ð8Ñ&7™d˜a�1–6Ó&7ùs   ‚FTzversion mismatch: z, N)Ú_eventÚ_graphÚ_determine_edgesÚ_edgesÚitemsr^  rb  ÚbumpÚoutputsÚlookuprÛ   Úvaluesr›   )rO   r«   rk  r  ÚedgeÚkÚvÚversionss   &&&     r'   r  ÚDataFlowNode.__init__­  sñ   € ØŒØŒØ59×5JÑ5JÓ5LˆŒàŸ™×*Ñ*Ö,‰IˆCØ�|�|Š| D×$6×$6Ò$6Ø—‘× Ñ  Ö%ñ -ð
 ?C¿l¹l×>PÑ>PÔ>RÔSÑ>R±d°a�A˜4Ÿ;™;×-Ñ-¨aÓ0Ð1Ò1Ñ>RˆÑSß‹sÑ8 h§o¡oÔ&7Ó8�s�sŠsÑ8 h§o¡oÔ&7Ó8×8Ò8Ü Ð#5°h°Z¸rÀ$Ç+Á+ÀÐ!OÓPÐPñ 9ùó Ts   Â%(Ec               ó   € V ^8„  d   QhRR/# )rD   rE   zdict[TensorKey, DataFlowEdge]r   )rG   s   "r'   rH   rm  »  s   € ÷ 2Oñ 2OÐ"?ñ 2Or&   c                	óv  € \        \        P                  ! V P                  .4      4      p/ pR  V 4        Fì  p\	        VP
                  \        P                  V4      RR7       Fº  w  rE\        V\        4      '       dA   \        P                  V4      pVP                  V\        4       4      P                  V4       K[  \        V\        4      '       g   Ks  V FA  p\        P                  V4      pVP                  V\        4       4      P                  V4       KC  	  K¼  	  Kî  	  \         P"                  ! \$        4      pVP'                  4        Fc  w  riVf   K  V'       d   V P(                  P+                  V4      MRW†,          n        RV	9   ;'       g    \        V	4      R8H  p
W¨V,          n        Ke  	  V FÎ  pVP0                  ^ ,          \2        P4                  8X  g   K+  VP0                  ^,          P6                  ^ 8  g   KO  \        P9                  VP0                  ^,          4      pW†,          pVe   VP.                  f   \;        RV 24      hRVn        V'       d   V P(                  P+                  V4      MRVn        KÐ  	  V F�  pVP0                  ^ ,          \2        P4                  8X  g   K+  VP0                  ^,          P6                  ^ 8”  g   KO  RV\        P9                  VP0                  ^,          4      ,          n        Kƒ  	  \=        \?        R VP'                  4        4       4      4      # )c              3  ó–   "  € T F?  qP                   ^ ,          \        P                  8X  g   K*  VP                   ^,          x € KA  	  R# 5irE  )r’   r   r“   rç   s   & r'   r»   Ú0DataFlowNode._determine_edges.<locals>.<genexpr>À  s/   é € ÐS¡w !·'±'¸!µ*Ä
×@RÑ@RÑ2R”:�1—7‘7˜1—:’:£wùs
   ‚'A	®A	TrØ   NzDouble delete: c              3  ó8   "  € T F  w  rVf   K  W3x € K  	  R # 5irW   r   ©rº   r{  r|  s   &  r'   r»   r‚  í  s   é € ÐM©m¡d a¸qœ6˜A�6«mùs   ‚�éÿÿÿÿrW   ) r°   r   r  rq  rÜ   r—   r´   rÆ   rX   r   r   rƒ   r7  ÚsetÚaddrË   ÚcollectionsÚdefaultdictr\  ru  rr  rx  r]  r^  r’   r   r4  r6  r|   r›   Údictr  )rO   ÚsubtreeÚmutable_by_keyrR  Úop_inputrÂ   r  Ú
op_input_iÚedgesÚmutable_setr^  rÄ   rz  s   &            r'   rs  ÚDataFlowNode._determine_edges»  s_  € Üœ×+Ò+¨T¯[©[¨MÓ:Ó;ˆð DFˆÙS¡wÖSˆBÜ%(Ø—	‘	œ=×;Ñ;¸BÓ?È÷&Ñ!�ô ˜h¬×8Ò8Ü#×/Ñ/°Ó9�CØ"×-Ñ-¨c´3³5Ó9×=Ñ=¸gÖFô   ¬$×/Ô/Û&.˜
Ü'×3Ñ3°JÓ?˜Ø&×1Ñ1°#´s³uÓ=×AÑAÀ'ÖJó '/ó&ñ Tô  ×'Ò'¬Ó5ˆØ .× 4Ñ 4Ö 6ÑˆCØŒßFI¨4¯;©;×+=Ñ+=¸cÔ+BÈr�•
Ô(ð
   ;Ñ.×RÐR´E¸+Ó4FÈ'Ñ4Q�Ø%,�c•
Ö"ñ !7ó ˆAØ�w‰w�q�zœZ×2Ñ2Ö2°q·w±w¸qµz×7LÑ7LÈqÖ7PÜ×/Ñ/°·±¸µ
Ó;�Ø•z�Ø’? t§|¡|Ò';Ü(¨?¸3¸%Ð)@ÓAÐAØ#�”ß@C T§[¡[×%7Ñ%7¸Ô%<È�Ö"ñ ó ˆAØ�w‰w�q�zœZ×2Ñ2Ö2°q·w±w¸qµz×7LÑ7LÈqÖ7PØMQ�”i×/Ñ/°·±¸µ
Ó;Õ<ÖJñ ô
 ”FÑM¨e¯k©k¬mÓMÓMÓNÐNr&   c               ó   € V ^8„  d   QhRR/# )rD   rE   z!dict[TensorKey, tuple[bool, int]]r   )rG   s   "r'   rH   rm  ð  s   € ÷ 
ñ 
Ð9ñ 
r&   c           
     	óî   € V P                   P                  4        UUu/ uFI  w  rVP                  '       d   K  V\        VP                  4      \        \        VP                  4      3bKK  	  upp# u uppi rW   )rt  ru  rb  rU   r^  r   r?   r]  ©rO   r{  r|  s   &  r'   r—   ÚDataFlowNode.inputsï  s`   € ð Ÿ™×)Ñ)Ô+ô	
ñ ,‘�Ø—?•?ô =ˆA”�Q—Y‘Y“¤¤c¨1¯?©?Ó!;Ð<Ò<Ù+ò	
ð 	
ùó 
s
   žA1¹4A1c               ó   € V ^8„  d   QhRR/# )rD   rE   zdict[TensorKey, int]r   )rG   s   "r'   rH   rm  ú  s   € ÷ 
ñ 
Ð-ñ 
r&   c                	ó  € V P                   P                  4        UUu/ uF`  w  rVP                  '       d   VP                  '       d   VP                  '       g   K=  YP
                  f   ^ MVP
                  ^,           bKb  	  upp# u uppi rW   )rt  ru  rb  rf  r^  r]  r”  s   &  r'   rw  ÚDataFlowNode.outputsù  si   € ð Ÿ™×)Ñ)Ô+ô
á+‘�Ø——�¨¯¯¨¸!¿)½)ô EˆA—O‘OÒ+‰q°·±À1Õ1DÒDÙ+ò
ð 	
ùó 
s   ž*BÁ	BÁ'Bc               ó   € V ^8„  d   QhRR/# )rD   rE   ztuple[TensorKey, ...]r   )rG   s   "r'   rH   rm    s   € ÷ 
ñ 
Ð4ñ 
r&   c                	óº   € \         ;QJ d,    . R  V P                  P                  4        4       F  NK  	  5# ! R  V P                  P                  4        4       4      # )c              3  óz   "  € T F1  w  rVP                   '       g   K  VP                  '       g   K-  Vx € K3  	  R # 5irW   )rb  rf  r„  s   &  r'   r»   Ú-DataFlowNode.intermediates.<locals>.<genexpr>  s&   é € ð 
Ù-‘$�!°·µŒAÀQÇ]Å]�AŠAÓ-ùs   ‚;�;±
;)r°   rt  ru  rN   s   &r'   ÚintermediatesÚDataFlowNode.intermediates  sN   € çŒuñ 
ØŸ+™+×+Ñ+Ô-ó
�uð 	
ˆuñ 
ØŸ+™+×+Ñ+Ô-ó
ó 
ð 	
r&   c               ó   € V ^8„  d   QhRR/# r]   r   )rG   s   "r'   rH   rm    s   € ÷ )ñ )˜Cñ )r&   c                	ó.   € V P                   P                  # rW   )rq  r  rN   s   &r'   Ú
start_timeÚDataFlowNode.start_time  s   € à�{‰{×(Ñ(Ð(r&   )rt  rq  rr  N)r   r   r   r   r  rs  rŒ   r—   rw  r�  r¡  r%   r   r&   r'   ri  ri  ¬  s_   † õQõ2Oðh ô
ó ð
ð ô
ó ð
ð ô
ó ð
ð
 ô)ó ô)r&   ri  c                  ó”   € ] tR tRtR R lt]R R l4       tR R lt]R R	 l4       t]	R
 R l4       t
R R ltR R ltR R ltRtR# )rl  i  c               ó    € V ^8„  d   QhRRRR/# r-  r   )rG   s   "r'   rH   ÚDataFlowGraph.__annotate__  s   € ÷ ñ  ð ¨4ñ r&   c                	ó  € Wn         V P                  V4      V n        / V n        V P                   Uu. uF  p\        W 4      NK  	  upV n        V P                  P                  R  R7       V P                  4        R# u upi )c                ó   € V P                   # rW   )r¡  r  s   &r'   r  Ú(DataFlowGraph.__init__.<locals>.<lambda>  s   € ¨A¯LªLr&   r  N)	Ú_op_treeÚ_extract_leaf_eventsÚ_leaf_eventsÚ_active_versionÚleaf_eventsri  Ú_flow_nodesÚsortÚvalidate)rO   r.  Úes   && r'   r  ÚDataFlowGraph.__init__  sm   € ØŒØ ×5Ñ5°gÓ>ˆÔØ<>ˆÔØ;?×;KÒ;KÓLÑ;K°aœL¨Ö1Ñ;KÑLˆÔØ×Ñ×ÑÑ"8ÐÔ9Ø�‰Žùò Ms   ²A=c               ó   € V ^8„  d   QhRR/# )rD   rE   ztuple[DataFlowNode, ...]r   )rG   s   "r'   rH   r¥    s   € ÷ 'ñ 'Ð4ñ 'r&   c                	ó,   € \        V P                  4      # rW   )r°   r®  rN   s   &r'   Ú
flow_nodesÚDataFlowGraph.flow_nodes  s   € ä�T×%Ñ%Ó&Ð&r&   c               ó   € V ^8„  d   QhRR/# ©rD   rE   r	  r   )rG   s   "r'   rH   r¥    s   € ÷ /ñ /˜$ñ /r&   c           	     	ó€  € \        4       pV P                   Fp  p\        VP                  P                  4       4      pW,          pV'       d3   \	        R VP
                  P                   RVP                   RV 24      hW,          pKr  	  / pV P                   F¡  pVP                  P                  4        F1  w  pw  rxVP                  V^ 4      p	W˜8w  g   K"  \	        RV	 RV 24      h	  VP                  P                  4        F1  w  rhVP                  Wh4      p
WŠ8  d   \	        RV RV
 24      hW…V&   K3  	  K£  	  R# )zduplicate outputs: Ú z%version mismatch for input: expected z, got zversion regression: z < N)
r†  rµ  rw  ru  r›   rq  r–   rt  r—   rM  )rO   rw  rŽ   Únode_outputsÚ
duplicatesÚtensor_versionsr  rž   ÚversionÚexpectedÚprior_versions   &          r'   r°  ÚDataFlowGraph.validate  s6  € ä.1«eˆØ—O”OˆDÜ˜tŸ|™|×1Ñ1Ó3Ó4ˆLØ Õ/ˆJßÜ$Ø)¨$¯+©+×*:Ñ*:Ð);¸1¸T¿[¹[¸MÈÈ:È,ÐWóð ð Õ#ŠGñ $ð 13ˆØ—O”OˆDØ%)§[¡[×%6Ñ%6Ö%8Ñ!�‘\�aØ*×.Ñ.¨s°AÓ6�ØÖ&Ü(Ø?À¸zÈÐPWÈyÐYóð ñ &9ð !%§¡× 2Ñ 2Ö 4‘�Ø /× 3Ñ 3°CÓ A�ØÔ*Ü(Ø.¨w¨i°s¸=¸/ÐJóð ð (/ Ó$ó !5ó $r&   c               ó   € V ^8„  d   QhRR/# r%  r   )rG   s   "r'   rH   r¥  8  s   € ÷ !ñ !Ð7ñ !r&   c                	ó   € V P                   # rW   )r«  rN   s   &r'   r­  ÚDataFlowGraph.leaf_events7  s   € à× Ñ Ð r&   c               ó    € V ^8„  d   QhRRRR/# )rD   r.  r  rE   r&  r   )rG   s   "r'   rH   r¥  <  s   € ÷ 2Iñ 2I fð 2IÐ1Kñ 2Ir&   c                óŠ   aa€ . oR R loR VV3R llpV P                  VR7       F  pK  	  \        \        SR R7      4      # )a4  Partially traverse the op tree and extract top level ops.

Consider the following code:
```
with record_function("My annotation"):
    x.zero_()
    y.zero_()
```

The op tree (assuming no Autograd) will look like:
  <Python context>
    TorchOp: "My annotation"
      TorchOp: zero_
        TorchOp: fill_
      TorchOp: zero_
        TorchOp: fill_

The recursive structure of operator calls makes data flow unwieldy.
In order to simplify analysis we would like to select the highest level
ops to represent in the graph. In this case those are the `zero_` ops;
the fact that `fill_` is called is an implementation detail. We also
do not want to group everything under "My annotation" as this could
create overly coarse bundles and lose critical semantics.

To address this issue we walk over the graph and select the topmost
torch ops ** which match at least one operator schema **. These form
the leaves of the first pass through the op tree. (As well as any
allocations or frees which are not part of a kernel.) These events
form the logical nodes in our data flow graph.
c               ó    € V ^8„  d   QhRRRR/# )rD   r±  r   rE   rU   r   )rG   s   "r'   rH   Ú8DataFlowGraph._extract_leaf_events.<locals>.__annotate__^  s   € ÷ 	ñ 	�~ð 	¨$ñ 	r&   c                ó$  € V P                   ^ ,          \        P                  8H  ;'       df    V P                   ^,          P                  \        P
                  8H  ;'       g0    \        \        P                  V P                   ^,          4      4      # r­   )	r’   r   r“   r”   r   r•   rU   r´   r½   )r±  s   &r'   Úleaf_opÚ3DataFlowGraph._extract_leaf_events.<locals>.leaf_op^  sj   € Ø—7‘7˜1•:¤×!3Ñ!3Ñ3÷ ð Ø—‘˜•
× Ñ ¤K×$AÑ$AÑA÷ Að AÜœ×3Ñ3°A·G±G¸AµJÓ?Ó@ðr&   c               ó   € V ^8„  d   QhRR/# )rD   r±  r   r   )rG   s   "r'   rH   rÈ  d  s   € ÷ 	ñ 	˜>ñ 	r&   c                óœ   <€ S! V 4      '       g    V P                   \        P                  8X  d   SP                  V 4       . # V P                  # rW   )Útagr   r4  r®   r‘   )r±  r­  rÊ  s   &€€r'   Úchildren_fnÚ7DataFlowGraph._extract_leaf_events.<locals>.children_fnd  s:   ø€ Ù�q�zŠz˜QŸU™U¤j×&;Ñ&;Ô;Ø×"Ñ" 1Ô%Ø�	à—:‘:Ðr&   )rÏ  c                ó   € V P                   # rW   r  r  s   &r'   r  Ú4DataFlowGraph._extract_leaf_events.<locals>.<lambda>n  s   € °q·²r&   r  )r  r°   r  )r.  rÏ  rž   r­  rÊ  s   &  @@r'   rª  Ú"DataFlowGraph._extract_leaf_events;  sI   ù€ ðB -/ˆõ	÷	ñ 	ð —‘¨�Ö5ˆAÙñ 6ô ”V˜KÑ-FÔGÓHÐHr&   c               ó    € V ^8„  d   QhRRRR/# )rD   r  r   rE   r?   r   )rG   s   "r'   rH   r¥  p  s   € ÷ ñ ˜)ð ¨ñ r&   c                	ód   € V P                   P                  V^ 4      pVf   \        RV R24      hV# )r   zversion for key ú is None©r¬  r7  r›   )rO   r  r¾  s   && r'   rx  ÚDataFlowGraph.lookupp  s9   € Ø×&Ñ&×1Ñ1°#°qÓ9ˆØŠ?Ü Ð#3°C°5¸Ð!AÓBÐBØˆr&   c               ó    € V ^8„  d   QhRRRR/# ©rD   r  r   rE   r	  r   )rG   s   "r'   rH   r¥  v  s   € ÷ 6ñ 6˜	ð 6 dñ 6r&   c                	ó�   € V P                   P                  VR 4      pVf   \        RV R24      hV^,           V P                   V&   R # )Nzprior_version for key rÖ  )r¬  rM  r›   )rO   r  rÀ  s   && r'   rv  ÚDataFlowGraph.bumpv  sJ   € Ø×,Ñ,×0Ñ0°°dÓ;ˆØÒ Ü Ð#9¸#¸¸hÐ!GÓHÐHØ$1°AÕ$5ˆ×Ñ˜SÓ!r&   c               ó    € V ^8„  d   QhRRRR/# rÚ  r   )rG   s   "r'   rH   r¥  |  s   € ÷ )ñ )˜)ð )¨ñ )r&   c                	ó~   € V P                   P                  V^ 4      f   \        RV R24      hRV P                   V&   R# )r   Nzcannot delete key z, already deletedr×  rX  s   &&r'   ÚdeleteÚDataFlowGraph.delete|  sA   € Ø×Ñ×*Ñ*¨3°Ó2Ò:Ü Ð#5°c°UÐ:KÐ!LÓMÐMØ$(ˆ×Ñ˜SÓ!r&   )r¬  r®  r«  r©  N)r   r   r   r   r  rŒ   rµ  r°  r­  rŠ   rª  rx  rv  rß  r%   r   r&   r'   rl  rl    s_   † õð ô'ó ð'õ/ð< ô!ó ð!ð ô2Ió ð2Iõhõ6÷)ñ )r&   rl  c                  ó¶   € ] tR tRt$ RtR]R&   ]P                  ! ]R7      t	R]R&   ]P                  ! ]R7      t
R]R	&   ]P                  ! ]R7      tR
]R&   RtR# )ÚCategoryElementi‚  NúCategory | NoneÚby_id©Údefault_factoryzdict[TensorKey, Category]Úby_keyzdict[TensorAndID, Category]Ú
by_versionzset[TensorKey]Ú_by_id_keysetr   )r   r   r   r   rä  r<   ÚdataclassesÚfieldrŠ  rç  rè  r†  ré  r%   r   r&   r'   râ  râ  ‚  sP   ‡ à!€Eˆ?Ó!Ø(3×(9Ò(9È$Ô(O€FÐ%ÓOØ.9×.?Ò.?ÐPTÔ.U€JÐ+ÓUð %0×$5Ò$5ÀcÔ$J€M�>×Jr&   râ  c                  ó†   € ] tR tRt$ ]P
                  ! R R7      tR]R&   R R ltR R	 lt	R
 R lt
R R ltR R ltRtR# )ÚCategoryDicti�  c                 	ó6   € \         P                  ! \        4      # rW   )rˆ  r‰  râ  r   r&   r'   r  ÚCategoryDict.<lambda>�  s   € ¤× 7Ò 7¼Ô Hr&   rå  z-collections.defaultdict[int, CategoryElement]r1  c               ó$   € V ^8„  d   QhRRRRRR/# ©rD   r  r   Úcategoryr   rE   r	  r   )rG   s   "r'   rH   ÚCategoryDict.__annotate__“  s!   € ÷ 4ñ 4˜Yð 4°(ð 4¸tñ 4r&   c                	ó´   € W P                   VP                  ,          n        V P                   VP                  ,          P                  P	                  V4       R # rW   )r1  rd   rä  ré  r‡  ©rO   r  rò  s   &&&r'   Ú	set_by_idÚCategoryDict.set_by_id“  s6   € Ø%-�‰�S—V‘VÕÔ"Ø�‰�S—V‘VÕ×*Ñ*×.Ñ.¨sÖ3r&   c               ó$   € V ^8„  d   QhRRRRRR/# rñ  r   )rG   s   "r'   rH   ró  —  s!   € ÷ 4ñ 4˜ið 4°8ð 4Àñ 4r&   c                	óX   € W P                   VP                  ,          P                  V&   R # rW   )r1  rd   rç  rõ  s   &&&r'   Ú
set_by_keyÚCategoryDict.set_by_key—  s   € Ø+3�‰�S—V‘VÕ×#Ñ# CÓ(r&   c               ó(   € V ^8„  d   QhRRRRRRRR/# ©	rD   r  r   r¾  r?   rò  r   rE   r	  r   )rG   s   "r'   rH   ró  š  s/   € ÷ Cñ C )ð C°cð CÀXð CÐRVñ Cr&   c                	óZ   € W0P                   VP                  ,          P                  W3&   R # rW   )r1  rd   rè  ©rO   r  r¾  rò  s   &&&&r'   Úset_by_versionÚCategoryDict.set_by_versionš  s   € Ø:B�‰�S—V‘VÕ×'Ñ'¨¨Ó7r&   c               ó(   € V ^8„  d   QhRRRRRRRR/# rý  r   )rG   s   "r'   rH   ró  �  s2   € ÷ Mñ MØðMØ'*ðMØ6>ðMà	ñMr&   c                	óv   € V P                   VP                  ,          P                  P                  W3V4       R # rW   )r1  rd   rè  r7  rÿ  s   &&&&r'   Úsetdefault_by_versionÚ"CategoryDict.setdefault_by_version�  s)   € ð 	�‰�S—V‘VÕ×'Ñ'×2Ñ2°C°>À8ÖLr&   c               ó$   € V ^8„  d   QhRRRRRR/# )rD   r  r   r¾  r?   rE   rã  r   )rG   s   "r'   rH   ró  ¢  s!   € ÷ 
ñ 
�sð 
 Sð 
¨_ñ 
r&   c                	óB  € \        V\        4      '       d   \        V\        4      '       g   R # V P                  VP                  ,          pVP
                  ;'       gB    VP                  P                  VR 4      ;'       g    VP                  P                  W3R 4      # rW   )	rX   r   r   r1  rd   rä  rç  rM  rè  )rO   r  r¾  Úelements   &&& r'   rM  ÚCategoryDict.get¢  s|   € Ü�cœ3×Ò¬
°3¼	×(BÒ(BÙØ—,‘,˜sŸv™vÕ&ˆà�M‰M÷ <ð <Ø�~‰~×!Ñ! # tÓ,÷<ð <à×!Ñ!×%Ñ% s n°dÓ;ð	
r&   r   N)r   r   r   r   rê  rë  r1  r<   rö  rú  r   r  rM  r%   r   r&   r'   rí  rí  �  s=   ‡ à=H×=NÒ=NÙHô>€GÐ:ó õ4õ4õCõM÷

ñ 
r&   rí  c                  ó°   € ] tR tRtR R lt]R R l4       tR R ltR R	 ltR
 R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltRtR# )ÚMemoryProfilei­  c               ó    € V ^8„  d   QhRRRR/# r  r   )rG   s   "r'   rH   ÚMemoryProfile.__annotate__®  s   € ÷ $ñ $˜ð $°4ñ $r&   c                	óŒ  € \        V4      V n        \        V P                  4      V n        \	        V P                  4      V n        \        4       V n        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        V P                  4        R # rW   )r  r©  rl  Ú_data_flow_graphr+  Ú	_size_maprí  Ú_categoriesÚ_set_gradients_and_temporariesÚ#_set_parameters_using_python_tracerÚ_set_inputsÚ_set_parameters_using_data_flowÚ_set_activationsÚ_set_optimizer_stateÚ_set_autograd_detailr  s   &&r'   r  ÚMemoryProfile.__init__®  sŒ   € Ü˜v›ˆŒÜ -¨d¯m©mÓ <ˆÔÜ  §¡Ó/ˆŒÜ'›>ˆÔà×+Ñ+Ô-Ø×0Ñ0Ô2Ø×ÑÔØ×,Ñ,Ô.Ø×ÑÔØ×!Ñ!Ô#Ø×!Ñ!Ö#r&   c               ó   € V ^8„  d   QhRR/# )rD   rE   z-tuple[tuple[int, Action, KeyAndID, int], ...]r   )rG   s   "r'   rH   r  ½  s   € ÷ Bñ BÐGñ Br&   c           	     	óò  a € . p/ p/ pS P                   P                  4        EFq  pVP                  ^ ,          \        P                  8X  g   K,  VP                  ^,          pVP
                  pV^ 8„  pVP                  p\        P                  V4      p	V	e   W‚W—3&   K|  \        VP                  4      p
VP                  V
P                  3pV'       dZ   W³9   d(   VP                  V\        P                  V
^ 3V34       KÞ  RW;&   VP                  V\        P                  V
^ 3V34       EK
  VP                  V\        P                   V
^ 3V) 34       VP#                  VR4      '       d   EKK  VP                  R\        P$                  V
^ 3V) 34       EKt  	  S P'                  4       p\)        \+        VP-                  4       4      4      pV U
Uu. uF-  w  r®V
R3V9  g   K  V^ 8X  g   K  R\        P$                  W®33NK/  	  pp
pS P.                  P0                   EF  pVP2                  P5                  4        Fø  w  p
pVP6                  '       d0   W*R3,          pVP                  V\        P                  V
^ 334       MiVP8                  '       dX   VP:                  P                  pVP<                  pVf   \?        RV
 24      hVP                  V\        P                  W®334       VP@                  '       g   KÄ  W*R3,          pVP                  V\        P                   W­V
,          334       Kú  	  EK  	  VPC                  V 3R lV 4       4       VPE                  R R7       \G        V4      # u upp
i )r   TFzinput_version is None for key c              3  ó\   <"  € T F!  w  rw  r4WW43SP                   V,          3x € K#  	  R # 5irW   )r  )rº   ÚtimeÚactionr  r¾  rO   s   &    €r'   r»   Ú)MemoryProfile.timeline.<locals>.<genexpr>ù  s1   øé € ð 
á06Ñ,�™n˜sð ˜C˜>¨4¯>©>¸#Õ+>Õ?Û06ùs   ƒ),c                ó:   € V ^ ,          V ^,          P                   3# r­   )Úvaluer  s   &r'   r  Ú(MemoryProfile.timeline.<locals>.<lambda>þ  s   €  1 Q¥4¨¨1­¯©Ñ"4r&   r  r…  )$r©  r  r’   r   r4  r6  r  r   r|   r   r;   r@   r®   r1   r4   r3   r5   Úpopr2   Ú_category_snapshotrŠ  r  Úkeysr  rµ  rt  ru  rb  r^  rq  r]  r›   rf  Úextendr¯  r°   )rO   ÚoutputÚallocation_timesÚlive_unknownr«   r=  r6  rb  r   Útkeyr  Úptr_and_deviceÚsnapshotÚlast_versionr¾  ÚeventsrŽ   rz  s   f                 r'   ÚtimelineÚMemoryProfile.timeline¼  sý  ø€ à:<ˆØ>@ÐØFHˆà—]‘]×&Ñ&×(ˆEØ�{‰{˜1�~¤×!6Ñ!6Ö6Ø$Ÿ{™{¨1�~�Ø)×4Ñ4�
Ø *¨Q¡�Ø×'Ñ'�ä ×0Ñ0°Ó>�ØÒ#Ø>? dÐ%:Ó;ô ˜l×1Ñ1Ó2�CØ&2×&6Ñ&6¸¿
¹
Ð%C�Nß$Ø)Ô9Ø"ŸM™MØ!"¤F×$<Ñ$<¸sÀA¸hÈ
Ð Söð <@˜LÑ8Ø"ŸM™M¨1¬f¯m©m¸cÀ1¸XÀzÐ*R×SàŸ™ q¬&¯.©.¸3À¸(ÀZÀKÐ&PÔQØ+×/Ñ/°À×FÕFØ"ŸM™MØ!#¤V×%7Ñ%7¸#¸q¸ÀJÀ;Ð O÷ñ3 )ð: ×*Ñ*Ó,ˆÜœF 8§=¡=£?Ó3Ó4ˆñ !)ô9
á (‘�Ø�Tˆ{Ð"2Ñ2ô 5à7>À!±|ô 5ˆR”×#Ñ# c ^Ó4Ù (ð 	ñ 9
ð ×)Ñ)×4Õ4ˆDØ!Ÿ[™[×.Ñ.Ö0‘	��TØ×%×%Ð%Ø(¨t¨Õ5�AØ—M‘M 1¤f§m¡m°c¸1°XÐ">Õ?à—\—\�\ØŸ™×1Ñ1�AØ"×0Ñ0�GØ’Ü,Ð/MÈcÈUÐ-SÓTÐTØ—M‘M 1¤f×&>Ñ&>ÀÀÐ"OÔPà×#×#Ò#Ø(¨u¨Õ6�AØ—M‘M 1¤f§n¡n°sÈÕ<MÐ6NÐ"OÖPô 1ñ 5ð" 	�‰ô 
á06ó
ô 	
ð
 	�‰Ñ4ˆÔ5Ü�V‹}Ðùó;9
s   ÇM3Ç!M3Ç*M3c               ó   € V ^8„  d   QhRR/# rÐ   r   )rG   s   "r'   rH   r    s   € ÷ Jñ J¨tñ Jr&   c                	ó\   € V P                   P                  ! V/ VB \        P                  8H  # rW   )r  rM  r   r!   r   s   &*,r'   Ú_is_gradientÚMemoryProfile._is_gradient  s)   € Ø×Ñ×#Ò# TÐ4¨VÑ4¼×8IÑ8IÑIÐIr&   c               ó   € V ^8„  d   QhRR/# )rD   rE   z"dict[TensorAndID, Category | None]r   )rG   s   "r'   rH   r    s   € ÷ 
ñ 
Ð$Fñ 
r&   c           	     	ó`  € \        4       pV P                  P                   F~  pVP                  R  VP                  P                  4        4       4       VP                  R VP                   4       4       VP                  VP                  P                  4       4       K€  	  V P                  P                  P                  4        F%  pVP                  R VP                   4       4       K'  	  \        V4       UUu/ uF"  w  rEWE3V P                  P                  WE4      bK$  	  upp# u uppi )c              3  ó2   "  € T F  w  pw  r#W3x € K  	  R # 5irW   r   )rº   r{  rž   r|  s   &   r'   r»   Ú3MemoryProfile._category_snapshot.<locals>.<genexpr>  s   é € Ð'TÑ@S±9°1±f°q¨­Ó@Sùó   ‚c              3  ó(   "  € T F  q^ 3x € K
  	  R# 5irE  r   ©rº   r  s   & r'   r»   r8  	  s   é € Ð&NÑ;M°C¨Q¥xÓ;Mùó   ‚c              3  ó(   "  € T F  q^ 3x € K
  	  R# 5irE  r   r;  s   & r'   r»   r8    s   é € Ð&K¹?°C¨Q¥x»?ùr<  )r†  r  rµ  r:  r—   ru  r�  rw  r  r1  ry  ré  r  rM  )rO   Úall_tensor_versionsrŽ   rÄ   r  r¾  s   &     r'   r$  Ú MemoryProfile._category_snapshot  sö   € Ü03³Ðà×)Ñ)×4Ô4ˆDØ×&Ñ&Ñ'TÀÇÁ×@QÑ@QÔ@SÓ'TÔUØ×&Ñ&Ñ&N¸4×;MÒ;MÓ&NÔNØ×&Ñ& t§|¡|×'9Ñ'9Ó';Ö<ñ 5ð
 ×!Ñ!×)Ñ)×0Ñ0Ö2ˆAØ×&Ñ&Ñ&K¸1¿?º?Ó&KÖKñ 3ô
 !'Ð':Ô ;ô
á ;‘�ð ˆN˜D×,Ñ,×0Ñ0°Ó>Ò>Ù ;ò
ð 	
ùó 
s   Ã>(D*c               ó   € V ^8„  d   QhRR/# )rD   rE   zset[int]r   )rG   s   "r'   rH   r    s   € ÷ "+ñ "+°(ñ "+r&   c                óÖ  a a€ \        4       o \        S4      pS P                  P                   F¤  p\        ;QJ d0    . VV 3R lVP
                  P                  4        4       F  NK  	  5M)! VV 3R lVP
                  P                  4        4       4      pV'       g   Kq  SP                  V4       SP                  R VP                   4       4       K¦  	  \        S4      V8X  g   KÜ  S# )a  Extract IDs of Tensors which depend or will depend on a gradient.

Note that this weakened definition of "depends" requires us to loop
over the data flow graph multiple times because it allows dependency
information to flow backward through edges and removes the guarantee
that nodes are topologically sorted. (Or indeed, even that a valid
topological order exists.) Put another way, we have converted an
acyclic data flow graph into a cyclic graph and we are attempting to
partition cycles involving a gradient from the rest of the graph.
c              3  óè   <"  € T Fg  w  pw  r#SP                   P                  W4      \        P                  \        P                  39   g   VP
                  S9   g   KY  VP
                  x € Ki  	  R # 5irW   )r  rM  r   r!   r#   rd   )rº   r  rž   r¾  Údepends_on_gradientrO   s   &   €€r'   r»   ÚAMemoryProfile._any_version_depends_on_gradient.<locals>.<genexpr>#  s_   øé € ð á-@Ñ)˜™\˜aØ×'Ñ'×+Ñ+¨CÓ9Ü ×)Ñ)¬8×+=Ñ+=Ð>ô?à—v‘vÐ!4Ñ4ô	 �C—F–FÛ-@ùs   ƒAA2ÁA2c              3  ó8   "  € T F  qP                   x € K  	  R # 5irW   )rd   r;  s   & r'   r»   rD  .  s   é € Ð.NÁ¸#¯v®vÃùs   ‚)	r†  rÚ   r  rµ  r°   r—   ru  r:  rw  )rO   Ú
start_sizerŽ   ÚidsrC  s   f   @r'   Ú _any_version_depends_on_gradientÚ.MemoryProfile._any_version_depends_on_gradient  s¸   ù€ ô ),«ÐØÜÐ0Ó1ˆJØ×-Ñ-×8Ô8�ß”eõ à-1¯[©[×->Ñ->Ô-@ó—e‘eõ à-1¯[©[×->Ñ->Ô-@óó �÷ ‘3Ø'×.Ñ.¨sÔ3à'×.Ñ.Ñ.NÀÇÂÓ.NÖNñ 9ô& Ð&Ó'¨:Ö5Ø*Ð*r&   c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  8  s   € ÷ Cñ C°ñ Cr&   c                óx  € V P                   P                  4        FA  p\        V4       F/  w  r#V P                  P	                  V\
        P                  4       K1  	  KC  	  V P                  P                   F@  pVP                   F-  pV P                  P                  V\
        P                  4       K/  	  KB  	  R# )z>Mark Tensors which are unambiguous and simple to reason about.N)r©  r  r©   r  rö  r   r!   r  rµ  r�  rú  r   )rO   r«   rž   r    rŽ   rÄ   s   &     r'   r  Ú,MemoryProfile._set_gradients_and_temporaries8  sŒ   € ð —]‘]×&Ñ&Ö(ˆEÜ.¨uÖ5‘	�Ø× Ñ ×*Ñ*¨6´8×3DÑ3DÖEó 6ñ )ð ×)Ñ)×4Ô4ˆDØ×'Ô'�Ø× Ñ ×+Ñ+¨A¬x×/AÑ/AÖBó (ó 5r&   c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  I  s   € ÷ Fñ F°Tñ Fr&   c                	óÌ   € V P                   P                  4        FE  p\        V4       F3  pVf   K	  V P                  P	                  V\
        P                  4       K5  	  KG  	  R # rW   )r©  r  r¦   r  rö  r   r#   )rO   r«   rŸ   s   &  r'   r  Ú1MemoryProfile._set_parameters_using_python_tracerI  sI   € Ø—]‘]×&Ñ&Ö(ˆEÜ'¨Ö.�Ø”=Ø×$Ñ$×.Ñ.¨q´(×2DÑ2DÖEó /ó )r&   c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  O  s   € ÷ 1Uñ 1U˜Tñ 1Ur&   c                ój  a a€ S P                  4       p\        4       o\        S P                  P                  4       F£  pVP
                  P                  4        UUUu0 uF  w  pw  rEW53kK  	  ppppWbP                  P                  4       ,          p\        ;QJ d     VV 3R lV 4       F  '       g   K   RM	  RM! VV 3R lV 4       4      '       g   Kš  SV,          oK¥  	  SP                  4       pS P                  P                   FW  p\        P                  \        VP                  4      9   g   K-  V\        VP                  P                  4       4      ,          pKY  	  V FB  w  r5VP                  V9  g   K  S P                  P!                  W5\"        P$                  4       KD  	  R# u upppi )aM  Mark inputs based on which Tensors are updated using gradients.

The process for differentiating between inputs and activations is more
involved. Most Tensors in a training loop depend on at least one
gradient: parameters depend on them through updates, and activations
and optimizer state depend on them transitively through parameters.
Critically, we do not need to know which Tensors are parameters to
apply this method; we can simply walk the data flow graph to build the
set of all values which depend on a gradient and then obtain the set
of inputs from the conjugate set.

There is, however, one hiccup. The first time we see a parameter is
generally on the forward pass of the first step. We know from
inspection of the data flow graph that v1 of that Tensor depends on
a gradient (provided we profile an optimizer step), but not v0. To
address this problem we weaken the definition of "depends on a
gradient" to "any version of this Tensor depends on a gradient",
which in turn strengthens the criteria for the input set enough to
filter the activations in the forward pass of the first step.c              3  ó´   <"  € T FM  pSP                   P                  ! V!  \        P                  \        P                  39   ;'       g    VS9   x € KO  	  R # 5irW   )r  rM  r   r!   r#   )rº   rÄ   Úproduces_gradientrO   s   & €€r'   r»   Ú,MemoryProfile._set_inputs.<locals>.<genexpr>p  sY   øé € ð ñ !�Að × Ñ ×$Ò$ aÑ(¬X×->Ñ->Ä×@RÑ@RÐ,SÑS÷ *ð *ØÐ)Ñ)ô*ã ùs   ƒAAÁ
ATFN)rH  r†  Úreversedr  rµ  r—   ru  rw  ÚanyÚcopyr   r•   r²   rq  rd   r  r  r   r   )	rO   rC  rŽ   r  rž   r¾  ÚtensorsÚinput_candidatesrS  s	   f       @r'   r  ÚMemoryProfile._set_inputsO  sP  ù€ ð2 #×CÑCÓEÐô /2«eÐÜ˜T×2Ñ2×=Ñ=Ö>ˆDØ?C¿{¹{×?PÑ?PÔ?RÕSÑ?RÑ*;¨#©|°˜“~Ñ?RˆGÒSØ—|‘|×)Ñ)Ó+Õ+ˆGß‹sõ ñ !ó�s�sŠsõ ñ !ó÷ ô ð
 " WÕ,Ò!ñ ?ð -×1Ñ1Ó3ÐØ×)Ñ)×4Ô4ˆDÜ×,Ñ,´
¸4¿;¹;Ó0GÖGØ ¤C¨¯©×(:Ñ(:Ó(<Ó$=Õ=Ò ñ 5ó -‰LˆCØ�v‰vÐ0Ö0Ø× Ñ ×6Ñ6°sÄXÇ^Á^ÖTó -ùô! Ts   ÁF.
c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  ‚  s   € ÷ HDñ HD°ñ HDr&   c                ó¢  a a€ S P                  4       p\        4       pVP                  4        UUu0 uF  w  r4V\        P                  8X  g   K  VkK   	  pppS P
                  P                   EFg  pVP                  P                  4        UUU	u0 uF  w  pw  r‰Wy3kK  	  p
ppp	\        P                  \        VP                  4      9  g   Ka  \        ;QJ d    V 3R lV
 4       F  '       g   K   RM	  RM! V 3R lV
 4       4      '       d   K£  \        ;QJ d7    V 3R lVP                  P                  4        4       F  '       g   K   RM,	  RM(! V 3R lVP                  P                  4        4       4      '       d   EK  VP                  V
4      '       g   EK0  WVP                  P                  4       ,          pW*P                  V4      ,          pEKj  	  \        4       o\!        S P
                  P                  4       F§  p\        ;QJ d8    V V3R lVP                  P                  4        4       F  '       g   K   RM-	  RM)! V V3R lVP                  P                  4        4       4      '       g   Kw  SP#                  R VP                  P                  4        4       4       K©  	  VP%                  S4       V UUu0 uF  w  rxVP&                  kK  	  pppVS P)                  4       ,          pV FB  w  rxVP&                  V9   g   K  S P*                  P-                  V\        P.                  4       KD  	  R# u uppi u up	ppi u uppi )aN  Deduce which Tensors are parameters.

Consider the following code for the step of SGD with momentum
(nesterov=False), where `d_p` is the gradient of `param` and `buf` is
the momentum buffer.
```
  buf.mul_(momentum).add_(d_p, alpha=1 - dampening)
  d_p = buf
  param.add_(d_p, alpha=-lr)
```
Both `param` and `buf` take a gradient and perform an in-place update.

The python tracer will inspect calls to `nn.Module.forward` and
`optim.Optimizer.step` to extract parameter and optimizer state
respectively (including parameters), so this is generally a non-issue.

However as a fallback we can also exploit several properties of
parameters to distinguish them from other model state.

First, they are directly used in the forward pass. (At this point we
haven't established which parts of the graph correspond to the forward
pass but we can deduce enough to suffice.) Some mutable state such as
batch norm moving averages also contribute to the forward pass, but
optimizer state does not.

Second, a parameter is by definition used to compute at least one
gradient and depends on at least one gradient.
c              3  óD   <"  € T F  pSP                   ! V!  x € K  	  R # 5irW   ©r3  ©rº   rÄ   rO   s   & €r'   r»   Ú@MemoryProfile._set_parameters_using_data_flow.<locals>.<genexpr>¯  s   øé € ÐB¹6°a˜D×-Ò-¨qÖ1»6ùó   ƒ TFc              3  óD   <"  € T F  pSP                   ! V!  x € K  	  R # 5irW   r^  r_  s   & €r'   r»   r`  °  s   øé € ÐPÑ;O°a˜D×-Ò-¨qÖ1Ó;Oùra  c              3  ó^   <"  € T F"  pSP                   ! V!  ;'       g    VS9   x € K$  	  R # 5irW   r^  )rº   rÄ   rO   Úused_for_gradients   & €€r'   r»   r`  »  s4   øé € ð á-�Að ×!Ò! 1Ñ%×?Ð?¨Ð.?Ñ)?Ô?Û-ùs   ƒ-Ÿ-c              3  ó2   "  € T F  w  pw  r#W3x € K  	  R # 5irW   r   )rº   r  rž   r¾  s   &   r'   r»   r`  ¿  s   é € ð )Ù<OÑ'8 s©L¨Q�S•NÓ<Oùr9  N)r$  r†  ru  r   r   r  rµ  r—   r   r•   r²   rq  rV  rw  ÚintersectionÚ
differencerU  r:  Úintersection_updaterd   rH  r  rö  r#   )rO   r,  Úcandidate_parametersrÄ   rò  Úcandidate_fwd_tensorsrŽ   r  rž   r!  r—   Úparameter_keysrd  s   f           @r'   r  Ú-MemoryProfile._set_parameters_using_data_flow‚  sg  ù€ ð: ×*Ñ*Ó,ˆô 25³Ðà!)§¡Ô!1ô3
Ù!1‘+�!°XÄÇÁÑ5O�AˆAÑ!1ð 	ñ 3
ð ×)Ñ)×4Õ4ˆDØ:>¿+¹+×:KÑ:KÔ:MÕNÑ:M¡ s©J¨Q�s“lÑ:MˆFÒNô ×-Ñ-´ZÀÇÁÓ5LÖLß›ÔB¹6ÓBŸŸšÔB¹6ÓB×BÔBß›ÔP¸4¿<¹<×;MÑ;MÔ;OÓPŸŸšÔP¸4¿<¹<×;MÑ;MÔ;OÓP×PÕPð *×6Ñ6°v×>Õ>à%¯©×);Ñ);Ó)=Õ=Ð%Ø$×(9Ñ(9Ð:OÓ(PÕPÓ$ñ 5ô /2«eÐÜ˜T×2Ñ2×=Ñ=Ö>ˆDß‹sõ àŸ™×+Ñ+Ô-ó�s�sŠsõ àŸ™×+Ñ+Ô-ó÷ ô ð "×(Ñ(ñ )Ø<@¿K¹K×<MÑ<MÔ<Oó)ö ñ ?ð 	×0Ñ0Ð1BÔCñ 0DÔDÑ/C¡V S˜#Ÿ&œ&Ñ/CˆÑDØ˜$×?Ñ?ÓAÕAˆã‰FˆCØ�v‰v˜Ö'Ø× Ñ ×*Ñ*¨3´×0BÑ0BÖCó ùóE3
ùô
 Oùó4 Es   °L>ÁL>ÂM
ËMc               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  Ì  s   € ÷ Tñ T $ñ Tr&   c                óÌ  € \         P                  \         P                  0p\         P                  \         P                  0pV P
                  P                   Fý  pVP                  P                  4        UUUu0 uF  w  pw  rVWF3kK  	  ppppV Uu0 uF  q€P                  P                  ! V!  kK  	  p	pW‘,          '       g   Kn  W‘V,          ,
          '       d   K…  \        P                  \        VP                  4      9  g   K¯  VP                  P                  4        F0  pV P                  P                   ! . VO\         P                  N5!   K2  	  Kÿ  	  R# u upppi u upi )z(Flood the graph to identify activations.N)r   r   r    r#   r   r  rµ  r—   ru  r  rM  r   r•   r²   rq  rw  r  )
rO   ÚrequiredÚalso_allowedrŽ   r  rž   r!  r—   rÄ   Úinput_categoriess
   &         r'   r  ÚMemoryProfile._set_activationsÌ  s  € ô —N‘N¤H×$7Ñ$7Ð8ˆÜ ×*Ñ*¬H×,>Ñ,>Ð?ˆØ×)Ñ)×4Ô4ˆDØ:>¿+¹+×:KÑ:KÔ:MÕNÑ:M¡ s©J¨Q�s“lÑ:MˆFÒNÙBHÓIÁ&¸Q× 0Ñ 0× 4Ò 4°aÔ 8Á&ÐÐIð "×,Ö,Ø)¸Õ-D×EÖEô  ×1Ñ1¼ÀDÇKÁKÓ9PÖPàŸ™×+Ñ+Ö-�AØ×$Ñ$×:Ò:ÐS¸AÐS¼x×?RÑ?RÖSó .ó 5ùÜNùÚIs   Á8E
Â"E!c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  ß  s   € ÷ 	Rñ 	R dñ 	Rr&   c                	ó  € V P                   P                  4        Fë  pVP                  ^ ,          \        P                  8X  g   K+  VP                  ^,          P
                  '       g   KP  VP                  ^,          P
                  P                  p\        P                  P                  R V 4       4       FJ  w  r4\        P                  V4      pVf   K   V P                  P                  V\        P                  4       KL  	  Kí  	  R# )r   c              3  ó,   "  € T F
  w   rVx € K  	  R # 5irW   r   )rº   rž   r;  s   &  r'   r»   Ú5MemoryProfile._set_optimizer_state.<locals>.<genexpr>ä  s   é € Ð9©j™{˜q !•U«jùs   ‚N)r©  r  r’   r   r˜   rš   rœ   ÚitÚchainÚfrom_iterabler   rƒ   r  rö  r   r$   )rO   r«   rœ   rž   r   r  s   &     r'   r  Ú"MemoryProfile._set_optimizer_stateß  s±   € Ø—]‘]×&Ñ&Ö(ˆEØ�{‰{˜1�~¤×!2Ñ!2Ö2°u·{±{À1µ~×7O×7OÒ7OØ"Ÿ[™[¨�^×5Ñ5×@Ñ@�
ÜŸH™H×2Ñ2Ù9©jÓ9ö‘D�Aô $×/Ñ/°Ó2�CØ”Ø×(Ñ(×2Ñ2°3¼×8PÑ8PÖQóó )r&   c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r  ê  s   € ÷ ñ  dñ r&   c                	ó²  € R \         P                  0pV P                  P                   Fª  p\        P
                  \        VP                  4      9   g   K-  VP                  P                  4        F_  w  r4V^ 8X  g*   V P                  P                  W4^,
          4      V9   g   K5  V P                  P                  W4\         P                  4       Ka  	  K¬  	  R # rW   )r   r"   r  rµ  r   r•   r²   rq  rw  ru  r  rM  r  )rO   ÚpriorrŽ   r  r¾  s   &    r'   r  Ú"MemoryProfile._set_autograd_detailê  s›   € Ø”x×/Ñ/Ð0ˆØ×)Ñ)×4Ô4ˆDÜ×,Ñ,´
¸4¿;¹;Ó0GÖGØ$(§L¡L×$6Ñ$6Ö$8‘L�CØ !”| t×'7Ñ'7×';Ñ';¸CÈ1ÅÓ'MÐQVÖ'VØ×(Ñ(×>Ñ>Ø¬(×*BÑ*Böó %9ó 5r&   )r  r  r©  r  N)r   r   r   r   r  rŒ   r/  r3  r$  rH  r  r  r  r  r  r  r  r%   r   r&   r'   r  r  ­  s`   † õ$ð ôBó ðBõHJõ
õ "+õHCõ"Fõ1UõfHDõTTõ&	R÷ñ r&   r  c                  óP   € ] tR tRtR R ltR tR R ltR R ltRR
 R lltRt	R	# )ÚMemoryProfileTimelineiõ  c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   Ú"MemoryProfileTimeline.__annotate__ö  s   € ÷ 	5ñ 	5¨$ñ 	5r&   c                óJ   € VP                   V n         VP                  V n        R# )a‹  The minimum representation of the memory profile timeline
includes the memory timeline and categories. The timeline
consists of [timestamp, action, (TensorKey, version), numbytes]
elements, to denote any actions (pre-existing, create, destroy,
or increment_version) that occurred to a specific Tensor for a
chunk of memory. The categories help map each (TensorKey,
version) pair into a category.N)r/  r  Ú
categories)rO   Úmemory_profiles   &&r'   r  ÚMemoryProfileTimeline.__init__ö  s   € ð '×/Ñ/ˆŒØ(×4Ñ4ˆŽr&   c                ó   a a€ \         P                  ! V4      p. p. oR V V3R llpRpS P                   EFo  w  rgw  r‰p
VP                  V8w  d   K  VR8w  d   \        VR,          4      pVR8X  g   We8  d
   V^ 8”  d   Tp\	        V4      ^ 8X  d@   VP                  V4       SP                  ^ .\         Uu. uF  p^ NK  	  up,           4       MDWcR,          8w  d8   VP                  V4       SP                  SR,          P                  4       4       V\        P                  \        P                  39   d   V! W‰V
4       EK  V\        P                  8X  d   V! W‰V
) 4       V! W‰^,           V
4       EKB  V\        P                  8X  d   V! W‰V
) 4       EKd  \        RV 24      h	  V Uu. uF  qf^ 8  d   TMTNK  	  ppVS3# u upi u upi )zÉConvert the memory timeline and categories into a memory plot
consisting of timestamps and their respective sizes by category
for a given device.

Input: device
Output: [timestamps, sizes by category]
c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   Ú>MemoryProfileTimeline._coalesce_timeline.<locals>.__annotate__  s   € ÷ 	+ñ 	+¨4ñ 	+r&   c                óà   <€ \        V \        4      '       d   SP                  P                  W4      MR p\        V,          ^,           pSR,          V;;,          \        V4      ,          uu&   R # )Nr…  )rX   r   r„  rM  Ú_CATEGORY_TO_INDEXr?   )r  r¾  r@  rò  rˆ   rO   rJ  s   &&&  €€r'   r:  Ú8MemoryProfileTimeline._coalesce_timeline.<locals>.update  sW   ø€ ô ˜c¤9×-Ò-ð —‘×#Ñ# CÔ1àð ô
 ' xÕ0°1Õ4ˆEØ�"�I�e×¤ E£
Õ*Õr&   iè  úUnknown action: r…  )ré   r;   r/  r?   rÚ   r®   r‹  rW  r1   r2   r3   r4   r5   Ú
ValueError)rO   Ú
device_strr;   Útimesr:  Út_minr   r  r  r¾  Únumbytesrž   rJ  s   f&          @r'   Ú_coalesce_timelineÚ(MemoryProfileTimeline._coalesce_timeline  s™  ù€ ô —’˜jÓ)ˆØˆØ!#ˆ÷	+ñ 	+ð ˆØ37·=µ=Ñ/ˆA‘~˜ xØ�z‰z˜VÔ#Ùð �BŒwÜ˜˜D�“M�ð ˜Œ{˜qœy¨Q°¬UØ�ô �5‹z˜QŒØ—‘˜Q”Ø—‘˜a˜SÕ/AÓ#BÑ/A¨!£AÑ/AÑ#BÕBÕCà˜B•i”Ø—‘˜Q”Ø—‘˜U 2�YŸ^™^Ó-Ô.ð œ&×,Ñ,¬f¯m©mÐ<Ô<Ù�s X×.àœ6×3Ñ3Ô3Ù�s h YÔ/Ù�s a�K¨×2àœ6Ÿ>™>Ô)Ù�s h Y×/ô !Ð#3°F°8Ð!<Ó=Ð=ñC 4AñF 16Ó6±¨1˜aœ%‘ QÒ&±ˆÐ6Ø�eˆ|Ðùò+ $Cùò( 7s   Â7GÆ-Gc               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r‚  =  s   € ÷ 	)ñ 	)¸$ñ 	)r&   c                ó¼   € V P                  V4      w  r4^ RIp\        VR4      ;_uu_ 4       pVP                  W4.V4       RRR4       R#   + '       g   i     R# ; i)zxSaves the memory timeline as [times, sizes by category]
as a JSON formatted file to the given path for the given
device.NÚw)r“  ÚjsonÚopenÚdump)rO   Úpathr�  r�  rJ  r˜  Úfs   &&&    r'   Úexport_memory_timelineÚ,MemoryProfileTimeline.export_memory_timeline=  sB   € ð ×.Ñ.¨zÓ:‰ˆãä�$˜�_Œ_ Ø�I‰I�u�n aÔ(÷ �_�_Š_ús   ¬A
Á
A	c               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r‚  H  s   € ÷ D%ñ D%¸dñ D%r&   c                ó0  a € \         P                  ! V4      p. pV 3R lpS P                   EF  w  rgw  r‰p
VP                  V8w  d   K  V\        P                  \        P
                  39   d)   VP                  V\        V,          V
V! W‰4      34       Kj  V\        P                  8X  dW   VP                  V\        V,          V
) V! W‰4      34       VP                  V\        V,          V
V! W‰^,           4      34       KÕ  V\        P                  8X  d+   VP                  V\        V,          V
) V! W‰4      34       EK  \        RV 24      h	  ^ RIp\        VR4      ;_uu_ 4       pVP                  WL4       RRR4       R#   + '       g   i     R# ; i)z¬Saves the memory timeline as raw memory event tuples in the
form of (timestamp, action, numbytes, category)
as a JSON formatted file to the given path for the given
device.c                ó„   <€ \        V \        4      '       d   SP                  P                  W4      MR p\        V,          # rW   )rX   r   r„  rM  r‹  )r  r¾  rò  rO   s   && €r'   Úget_category_indexÚLMemoryProfileTimeline.export_memory_timeline_raw.<locals>.get_category_indexP  s;   ø€ ô ˜c¤9×-Ò-ð —‘×#Ñ# CÔ1àð ô
 & hÕ/Ð/r&   r�  Nr—  )ré   r;   r/  r1   r2   r3   r®   Ú_ACTION_TO_INDEXr4   r5   rŽ  r˜  r™  rš  )rO   r›  r�  r;   Ú
raw_eventsr¢  r   r  r  r¾  r’  r˜  rœ  s   f&&          r'   Úexport_memory_timeline_rawÚ0MemoryProfileTimeline.export_memory_timeline_rawH  sr  ø€ ô
 —’˜jÓ)ˆØ68ˆ
õ	0ð 48·=µ=Ñ/ˆA‘~˜ xØ�z‰z˜VÔ#Ùàœ&×,Ñ,¬f¯m©mÐ<Ô<Ø×!Ñ!ð Ü(¨Õ0Ø Ù*¨3Ó8ð	öð œ6×3Ñ3Ô3Ø×!Ñ!ð Ü(¨Õ0Ø!˜	Ù*¨3Ó8ð	ôð ×!Ñ!ð Ü(¨Õ0Ø Ù*¨3¸!µÓ<ð	öð œ6Ÿ>™>Ô)Ø×!Ñ!ð Ü(¨Õ0Ø!˜	Ù*¨3Ó8ð	÷ô !Ð#3°F°8Ð!<Ó=Ð=ñ_ 4Aób 	ä�$˜�_Œ_ Ø�I‰I�jÔ$÷ �_�_Š_ús   Å(FÆF	Nc               ó   € V ^8„  d   QhRR/# r¸  r   )rG   s   "r'   rH   r‚  Ž  s   € ÷ Dñ Dà	ñDr&   c           	     ó  € ^ RI pVP                  P                  R4      pVf   \        R4       R# ^ RIHp ^ RIHp ^ RIH	p	 ^ RI
p
V P                  V4      pV
P                  V^ ,          4      V
P                  V^,          4      rÜ\        V4      pWÎ,          pV
P                  V^R7      R,          p\        P                   ! V4      p\        P"                  P%                  V4      p\        P"                  P'                  V4      pV	P)                  V^PR7      pVP+                  4       p\,        P/                  4        FI  w  pp\0        V,          pVP3                  VR,          VR	V3,          VR	V^,           3,          VR
R7       KK  	  TP5                  \,         Uu. uF  pVf   RMVP6                  NK  	  up4       VP9                  R4       VP;                  R4       RP=                  V'       d   V.M. RVR,          R RVR,          R R2.,           4      pVP?                  V4       V! RRR7      ;_uu_ 4       pVPA                  VRR7       VPC                  ^ ^ 4       V! VPE                  4       4      PG                  R4      pV'       g   \I        R4      hRV R2p\K        VRRR7      ;_uu_ 4       pVPM                  V4       RRR4       RRR4       R# u upi   + '       g   i     L; i  + '       g   i     R# ; i) zkExports the memory timeline as an HTML file which contains
the memory timeline plot embedded as a PNG file.NÚ
matplotlibzDexport_memory_timeline_html failed because matplotlib was not found.)Ú	b64encode)ÚNamedTemporaryFile)Úaxis)ÚfigsizeÚdpig     @�@:NNNgffffffæ?)ÚcolorÚalphaÚUnknownz	Time (ms)zMemory (GB)z

zMax memory allocated: z.2fz GiB 
Max memory reserved: z GiBzw+bz.png)ÚsuffixÚpng)rG   zutf-8z failed to encode image as base64z}<html>
<head><meta charset="utf-8" /><title>GPU Memory Timeline HTML</title></head>
<body>
  <img src='data:image/png;base64,z'>
</body>
</html>r—  )Úencodingi   @)'Úimportlib.utilÚutilÚ	find_specÚprintÚbase64r«  Útempfiler¬  Úmatplotlib.pyplotÚpyplotÚnumpyr“  ÚarrayÚminÚcumsumré   r;   ÚcudaÚmax_memory_allocatedÚmax_memory_reservedÚfigureÚgcaÚ_CATEGORY_TO_COLORSru  r‹  Úfill_betweenÚlegendr–   Ú
set_xlabelÚ
set_ylabelÚjoinÚ	set_titleÚsavefigÚseekÚreadÚdecoder›   r™  Úwrite)rO   r›  r�  r®  ÚtitleÚ	importlibÚmatplotlib_specr«  r¬  ÚpltÚnpÚmtr�  rJ  r‘  Ústackedr;   rÃ  rÄ  ÚfigÚaxesrò  r°  rÄ   ÚtmpfileÚencodedÚhtmlrœ  s   &&&&&                       r'   Úexport_memory_timeline_htmlÚ1MemoryProfileTimeline.export_memory_timeline_htmlŽ  s™  € ó 	à#Ÿ.™.×2Ñ2°<Ó@ˆØÒ"ÜØVôñ å$Ý/å'Ûà×$Ñ$ ZÓ0ˆØ—x‘x  1¥“¨¯©°°Aµ«ˆuä�E“
ˆØ�ˆØ—)‘)˜E¨�)Ó*¨WÕ4ˆÜ—’˜jÓ)ˆÜ$Ÿz™z×>Ñ>¸vÓFÐÜ#Ÿj™j×<Ñ<¸VÓDÐð �j‰j ¨bˆjÓ1ˆØ�w‰w‹yˆÜ2×8Ñ8Ö:‰OˆH�eÜ" 8Õ,ˆAØ×ÑØ˜•˜W Q¨ T�]¨G°A°q¸1µu°HÕ,=ÀUÐRUð ö ñ  ;ð
 	�
‰
Õ@SÓTÑ@S¸1 ¢‘I°·±Ò6Ñ@SÑTÔUà�‰˜Ô$Ø�‰˜Ô&Ø—‘ßˆe‰W 2à(Ð)=ÀÕ)IÈ#Ð(Nð O(Ø(;¸wÕ(GÈÐ'LÈDðRðõó
ˆð 	�‰�uÔñ   ¨f×5Õ5¸Ø�K‰K˜¨ˆKÔ.à�L‰L˜˜AÔÙ §¡£Ó/×6Ñ6°wÓ?ˆGßÜ$Ð%GÓHÐHð#ð $+ )ð ,ðˆDô �d˜C¨'×2Õ2°aØ—‘˜”÷ 3÷ 6Ñ5ùò U÷8 3×2ú÷ 6×5Ð5ús+   ÆKÉA:K7Ê;K$	ËK7Ë$K4Ë/K7Ë7L	)r„  r/  ))é   é   N)
r   r   r   r   r  r“  r�  r¦  rß  r%   r   r&   r'   r€  r€  õ  s%   † õ	5ò:õx	)õD%÷LDó Dr&   r€  )GÚ
__future__r   rˆ  rê  r   Ú	itertoolsrw  ÚloggingÚtypingr   r   r   r   ré   Útorch._C._profilerr   r	   r
   r   r   r   Útorch._utilsr   Útorch.profilerr   Úcollections.abcr   Útorch._Cr   Útorch._C._autogradr   r°   r?   ÚKeyAndIDÚTensorAndIDÚ	getLoggerr   r8  ÚEnumr   r#   r$   r   r   r    r!   r"   rÇ  r¿   r‹  r1   r!  r¤  Ú	dataclassr   r>   r   r¡   r¦   r©   r²   r´   r  r+  r\  ri  rl  râ  rí  r  r€  )rÄ   Úcs   00r'   Ú<module>ró     s{  ðå "ã Û Û Û Û ß 4Ó 4ã ÷÷ õ 'Ý !÷ Ý(å'Ý2ð �˜�Õ€Ø�K Ð$Õ%€à×Ò˜Ó!€ô"ˆt�y‰yô "ð ×Ñ˜Ø×Ñ˜kØ‡N�N�GØ×Ñ˜Ø×Ñ˜Ø×Ñ�|Ø×Ñ˜kØˆ&ð	Ð ñ (1Ð1DÔ'EÔFÑ'E™t˜q�a’dÑ'EÒFÐ ôˆT�Y‰Yô ñ )/Ó/© 1�q—w‘w’J©Ñ/Ð ð ×Ò˜$¨E¸$Ô?÷ð ó @ðð ×Ñ÷(ð (ó ð(ð( ×Ò˜$¨D¸Ô>ô.X�ó .Xó ?ð.Xõb(NõVõõ÷oñ o÷d
"ñ 
"÷G!ñ G!ðT ×ÒÓ÷
$ð 
$ó ð
$÷])ñ ])÷@s)ñ s)ðl ×Ñ÷Kð Kó ðKð ×Ñ÷
ð 
ó ð
÷>Eñ E÷P
]ó ]ùów Gùò 0s   ÄIÄ+I