Ë
    g^(h  ã                   ó\   — d dl Zd dlmZmZ ddlmZmZ ddefd„Z	dd„Z
d„ Zd	„ Zdd
„Zd„ Zy)é    N)Útree_flattenÚtree_unflattené   )Úadd_step_closureÚrun_step_closuresÚdevicec                 óp   — t         j                  j                  j                  | g |¬«       t	        «        y)aV  Triggers a mark step, which amounts to
    - collecting a group of 'live' lazy tensors to index into the compilation cache
      (lowering/compiling their IR graphs if not cached)
    - kicking off execution of the compiled function
    - (optionally, wait=True) waiting for cpu-side execution to complete (does not sync the accelerator)
    )ÚwaitN)ÚtorchÚ_CÚ_lazyÚ
_mark_stepr   )r   r
   s     úR/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/_lazy/__init__.pyÚ	mark_stepr   	   s'   € ô 
‡H�H‡N�N×Ñ˜f b¨tÐÔ4äÕó    c                 ó`   — | €g } t         j                  j                  j                  | ¬«       y)zçWaits for all the async operations on the given devices to complete.
    Args:
      devices (string..., optional): The devices whose async ops need to be waited
        for. If empty, all the local devices will be waited for.
    N©Údevices)r   r   r   Ú_wait_device_opsr   s    r   Úwait_device_opsr      s'   € ð €ØˆÜ	‡H�H‡N�N×#Ñ#¨GÐ#Õ4r   c                 óX   — t         j                  j                  j                  | |«       y)z‹
    Sync the list of lazy tensors so there IR get lowered for the activate backend
    and the compiled computation graph get cached.
    N)r   r   r   Ú_sync_multi)Útensorsr   s     r   Ú
sync_multir   !   s   € ô
 
‡H�H‡N�N×Ñ˜w¨Õ0r   c                 óT   — t         j                  j                  j                  | «      S )z7Return a unique id of the lazy tensor maintained by LTC)r   r   r   Ú_get_tensor_id)Útensors    r   Úget_tensor_idr   )   s   € ä�8‰8�>‰>×(Ñ(¨Ó0Ð0r   c                 ó    — |xs dg}t        | «      \  }}t        ||«       t        |D �cg c]  }|j                  d«      ‘Œ c}|«      S c c}w )NÚlazyÚcpu)r   r   r   Úto)r   r   Ú	flattenedÚspecÚts        r   Úto_cpur&   .   sI   € ØÒ!˜&˜€Gä" 7Ó+�O€IˆtÜˆy˜'Ô"Ü°	Ö:¨1˜1Ÿ4™4 �;Ò:¸DÓAÐAùÒ:s   «Ac                 óH   — t        j                  t        | «      g|¢­i |¤Ž y ©N)r   Úsaver&   )r   ÚargsÚkwargss      r   r)   r)   6   s   € Ü	‡J�JŒv�g‹Ð0 Ò0¨Ó0r   )Ú Fr(   )Útorch._C._lazyr   Útorch.utils._pytreer   r   Úclosurer   r   Ústrr   r   r   r   r&   r)   © r   r   ú<module>r2      s6   ðó ß <ç 8ñ
�có 
ó5ò1ò1ó
Bó1r   