Ë
    S²j/J  ã            	       ó�  — U d Z ddlZddlZddlmZ ddlmZ ddlZddlmZ ddl	m
Z
mZ ddlmZ ddlmZ d	d
lmZ ej$                  Zej&                  ZdZeej,                  j.                  df   ed<   dag aeeeg df   ee   f      ed<    ej:                  «       Z ej>                  «       Z  e«       a! e"ej,                  d«      rej,                  jF                  Z$nde%de%fd„Z$ e"ej,                  d«      rej,                  jL                  Z'nde%de%fd„Z'd„ Z(d„ Z)d„ Z*de+fd„Z,dFd„Z- G d„ de.«      Z/de+fd„Z0de+fd„Z1dGdeddfd„Z2de%fd „Z3de%fd!„Z4dGdedefd"„Z5dGdedefd#„Z6	 dHd$edz  d%ed&e%ddfd'„Z7de8eef   fd(„Z9d)ee%e%e%e%gdf   ddfd*„Z:dId+e+fd,„Z;dGdedee%e%f   fd-„Z<dFd.„Z=d/efd0„Z>deddfd1„Z?dGdede8eef   fd2„Z@ G d3„ d«      ZA G d4„ d5«      ZBd6„ ZCd/edz  deBfd7„ZDdJdedefd8„ZEdee   fd9„ZFdJd:ededdfd;„ZGd<ee   ddfd=„ZHd>e%ddfd?„ZId>e%ddfd@„ZJde%fdA„ZKde%fdB„ZLde%fdC„ZMd	dDlN­ d	dDlO­ g dE¢ZPy)KzH
This package enables an interface for accessing MTIA backend in python
é    N)ÚCallable)ÚAny)ÚTensor)Ú	is_fbcodeÚis_prod)Ú_LazySeedTracker)ÚDeviceé   )Ú_get_device_index© .Údefault_generatorsFÚ_queued_callsÚ_mtia_exchangeDeviceÚdeviceÚreturnc                 ó$   — | dk  ryt        d«      ‚©Nr   éÿÿÿÿz)PyTorch was compiled without MTIA support©ÚRuntimeError©r   s    úR/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/mtia/__init__.pyÚ_exchange_devicer   )   ó   € Ø�AŠ:ØÜÐFÓGÐGó    Ú_mtia_maybeExchangeDevicec                 ó$   — | dk  ryt        d«      ‚r   r   r   s    r   Ú_maybe_exchange_devicer   3   r   r   c                  ó   — t        «        y ©N)Ú
_lazy_initr   r   r   Úinitr"   9   s   € Ü…Lr   c                  ó(   — t         xr t        «        S )z9Return whether PyTorch's MTIA state has been initialized.)Ú_initializedÚ_is_in_bad_forkr   r   r   Úis_initializedr&   =   s   € äÒ1¤Ó 1Ð1Ð1r   c                 ó¬  — t         5  t        «       r | «       cd d d «       S |j                  dd«      r)t        j	                  | t        j                  «       «       nd|j                  dd«      r)t        j                  | t        j                  «       «       n)t        j                  | t        j                  «       f«       d d d «       y # 1 sw Y   y xY w)NÚseed_allFÚseed)
Ú_initialization_lockr&   ÚgetÚ_lazy_seed_trackerÚqueue_seed_allÚ	tracebackÚformat_stackÚ
queue_seedr   Úappend)ÚcallableÚkwargss     r   Ú
_lazy_callr4   B   s¡   € Ü	ñ 
KÜÔÙ“:÷
Kñ 
Kð
 �z‰z˜* eÔ,Ü"×1Ñ1°(¼I×<RÑ<RÓ<TÕUØ—‘˜F EÔ*Ü"×-Ñ-¨h¼	×8NÑ8NÓ8PÕQä×$Ñ$ h´	×0FÑ0FÓ0HÐ%IÔJ÷
K÷ 
Kñ 
Kús   ‡C
¢BC
Ã
Cc                  ó>   — t         j                  j                  «       S r    )ÚtorchÚ_CÚ_mtia_isInBadForkr   r   r   r%   r%   P   s   € Ü�8‰8×%Ñ%Ó'Ð'r   c            	      ó  — t        «       st        t        d«      ry t        5  t        «       r
	 d d d «       y t	        «       rt        d«      ‚t        «       st        d«      ‚t        «       r!t        «       r	 ddl
m}  | j                  «        t        j                  j!                  «        dt        _        t$        j'                  d„ t(        j+                  «       D «       «       	 t$        D ]  \  }}	  |«        Œ 	 t5        t        d«       dad d d «       y # t        $ r Y Œ•w xY w# t,        $ r1}dt/        |«      › d	d
j1                  |«      › �}t3        |«      |‚d }~ww xY w# t5        t        d«       w xY w# 1 sw Y   y xY w)NÚis_initializingzwCannot re-initialize MTIA in forked subprocess. To use MTIA with multiprocessing, you must use the 'spawn' start methodzÖTorch not compiled with MTIA enabled. Ensure you have `import mtia.host_runtime.torch_mtia.dynamic_library` in your python src file and include `//mtia/host_runtime/torch_mtia:torch_mtia` as your target dependency!r   )Úcxx_resource_managerTc              3   ó&   K  — | ]	  }|sŒ|–— Œ y ­wr    r   )Ú.0Úcallss     r   ú	<genexpr>z_lazy_init.<locals>.<genexpr>�   s   è ø€ ÒX uÒRWœUÑXùs   ‚Šz6MTIA call failed lazily at initialization with error: z(

MTIA call was originally invoked at:

Ú )r&   ÚhasattrÚ_tlsr*   r%   r   Ú_is_compiledÚAssertionErrorr   r   Úlibfb.py.cxx_resourcesr;   ÚinstallÚModuleNotFoundErrorr6   r7   Ú
_mtia_initr:   r   Úextendr,   Ú	get_callsÚ	ExceptionÚstrÚjoinÚDeferredMtiaCallErrorÚdelattrr$   )r;   Úqueued_callÚorig_tracebackÚeÚmsgs        r   r!   r!   T   s}  € äÔœ7¤4Ð):Ô;ØÜ	ñ 7ô ÔØ÷7ð 7ô ÔÜðIóð ô Œ~Ü ð*óð ô Œ;œ7œ9ðÝGà$×,Ñ,Ô.ô
 	�‰×ÑÔð  $ŒÔä×ÑÑXÔ0B×0LÑ0LÓ0NÔXÔXð	-Ü/<ò <Ñ+�˜^ð<Ù•Mñ<ô ”DÐ+Ô,Øˆ÷o7ð 7øô> 'ò áðûô  !ò <àPÔQTÐUVÓQWÐPXð YCØCEÇ7Á7È>ÓCZÐB[ð]ð ô 0°Ó4¸!Ð;ûð<ûô ”DÐ+Õ,ú÷m7ð 7úsq   ¢E7·>E7Á6DÂAE7Ã$E"Ã1D%Ã8E"Ã;E7Ä	D"ÄE7Ä!D"Ä"E7Ä%	EÄ.,EÅEÅE"Å"E4Å4E7Å7F c                   ó   — e Zd Zy)rN   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   rN   rN   ’   s   „ Ør   rN   c                  ó>   — t         j                  j                  «       S )z*Return true if compiled with MTIA support.)r6   r7   Ú_mtia_isBuiltr   r   r   rC   rC   –   s   € ä�8‰8×!Ñ!Ó#Ð#r   c                  ó2   — t        «       syt        «       dkD  S )z'Return true if MTIA device is availableFr   )rC   Údevice_countr   r   r   Úis_availabler\   ›   s   € äŒ>Øä‹>˜AÑÐr   c                 ó¨   — t         j                  j                  | «      5  t         j                  j	                  «       cddd«       S # 1 sw Y   yxY w)z?Waits for all jobs in all streams on a MTIA device to complete.N)r6   Úmtiar   r7   Ú_mtia_deviceSynchronizer   s    r   Úsynchronizer`   £   s9   € ä	�‰×	Ñ	˜6Ó	"ñ 2Ü�x‰x×/Ñ/Ó1÷2÷ 2ò 2ús    AÁAc                  ó>   — t         j                  j                  «       S )z,Return the number of MTIA devices available.)r6   r7   Ú_mtia_getDeviceCountr   r   r   r[   r[   ©   s   € ä�8‰8×(Ñ(Ó*Ð*r   c                  ó>   — t         j                  j                  «       S )z0Return the index of a currently selected device.)r6   r7   Ú_mtia_getDevicer   r   r   Úcurrent_devicere   ®   s   € ô �8‰8×#Ñ#Ó%Ð%r   c                 óZ   — t        | d¬«      }t        j                  j                  |«      S )aS  Return the currently selected :class:`Stream` for a given device.

    Args:
        device (torch.device or int, optional): selected device. Returns
            the currently selected :class:`Stream` for the current device, given
            by :func:`~torch.mtia.current_device`, if :attr:`device` is ``None``
            (default).
    T©Úoptional)r   r6   r7   Ú_mtia_getCurrentStream)r   Ú
device_idxs     r   Úcurrent_streamrk   ´   s%   € ô # 6°DÔ9€JÜ�8‰8×*Ñ*¨:Ó6Ð6r   c                 óV   — t         j                  j                  t        | d¬«      «      S )a=  Return the default :class:`Stream` for a given device.

    Args:
        device (torch.device or int, optional): selected device. Returns
            the default :class:`Stream` for the current device, given by
            :func:`~torch.mtia.current_device`, if :attr:`device` is ``None``
            (default).
    Trg   )r6   r7   Ú_mtia_getDefaultStreamr   r   s    r   Údefault_streamrn   Á   s!   € ô �8‰8×*Ñ*Ô+<¸VÈdÔ+SÓTÐTr   ÚenabledÚstacksÚmax_entriesc                 ó\   — t        «       syt        j                  j                  | ||«       y)a•  Enable/Disable the memory profiler on MTIA allocator

    Args:
        enabled (all or state, optional) selected device. Returns
            statistics for the current device, given by current_device(),
            if device is None (default).

        stacks ("python" or "cpp", optional). Select the stack trace to record.

        max_entries (int, optional). Maximum number of entries to record.
    N)r&   r6   r7   Ú_mtia_recordMemoryHistory)ro   rp   rq   s      r   Úrecord_memory_historyrt   Í   s#   € ô ÔØÜ	‡H�H×&Ñ& w°¸ÕDr   c                  ó>   — t         j                  j                  «       S )z4Return a dictionary of MTIA memory allocator history)r6   r7   Ú_mtia_memorySnapshotr   r   r   Úsnapshotrw   à   s   € ô �8‰8×(Ñ(Ó*Ð*r   Úobserverc                 óB   — t         j                  j                  | «       y)z9Attach an out-of-memory observer to MTIA memory allocatorN)r6   r7   Ú_mtia_attachOutOfMemoryObserver)rx   s    r   Úattach_out_of_memory_observerr{   æ   s   € ô 
‡H�H×,Ñ,¨XÕ6r   Úincluding_emulationc                  ó   — y)zLReturn a bool indicating if the current MTIA device supports dtype bfloat16.Tr   )r|   s    r   Úis_bf16_supportedr~   í   s   € àr   c                 óV   — t         j                  j                  t        | d¬«      «      S )a  Return capability of a given device as a tuple of (major version, minor version).

    Args:
        device (torch.device or int, optional) selected device. Returns
            statistics for the current device, given by current_device(),
            if device is None (default).
    Trg   )r6   r7   Ú_mtia_getDeviceCapabilityr   r   s    r   Úget_device_capabilityr�   ò   ó"   € ô �8‰8×-Ñ-Ô.?ÀÐQUÔ.VÓWÐWr   c                  ó>   — t         j                  j                  «       S )zEmpty the MTIA device cache.)r6   r7   Ú_mtia_emptyCacher   r   r   Úempty_cacher…   ý   s   € ä�8‰8×$Ñ$Ó&Ð&r   Ústreamc                 óH   — | €yt         j                  j                  | «       y)a  Set the current stream. This is a wrapper API to set the stream.
        Usage of this function is discouraged in favor of the ``stream``
        context manager.

    Args:
        stream (Stream): selected stream. This function is a no-op
            if this argument is ``None``.
    N)r6   r7   Ú_mtia_setCurrentStream©r†   s    r   Ú
set_streamrŠ     s   € ð €~ØÜ	‡H�H×#Ñ# FÕ+r   c                 ód   — t        | «      } | dk\  r t        j                  j                  | «       yy)z¡Set the current device.

    Args:
        device (torch.device or int): selected device. This function is a no-op
            if this argument is negative.
    r   N)r   r6   r7   Ú_mtia_setDevicer   s    r   Ú
set_devicer�     s,   € ô ˜vÓ&€FØ�‚{ä�‰× Ñ  Õ(ð r   c                 óV   — t         j                  j                  t        | d¬«      «      S )zøReturn a dictionary of MTIA device properties

    Args:
        device (torch.device or int, optional) selected device. Returns
            statistics for the current device, given by current_device(),
            if device is None (default).
    Trg   )r6   r7   Ú_mtia_getDevicePropertiesr   r   s    r   Úget_device_propertiesr�     r‚   r   c                   ó6   — e Zd ZdZd efd„Zd„ Zdededefd„Zy)	r   zÌContext-manager that changes the selected device.

    Args:
        device (torch.device or int): device index to select. It's a no-op if
            this argument is a negative integer or ``None``.
    c                 ó6   — t        |d¬«      | _        d| _        y )NTrg   r   )r   ÚidxÚprev_idx)Úselfr   s     r   Ú__init__zdevice.__init__0  s   € Ü$ V°dÔ;ˆŒØˆ�r   c                 ó`   — t         j                  j                  | j                  «      | _        y r    )r6   r7   r   r“   r”   )r•   s    r   Ú	__enter__zdevice.__enter__4  s   € äŸ™×:Ñ:¸4¿8¹8ÓDˆ�r   ÚtypeÚvaluer.   c                 ó`   — t         j                  j                  | j                  «      | _        y)NF)r6   r7   r   r”   r“   )r•   r™   rš   r.   s       r   Ú__exit__zdevice.__exit__8  s   € ä—8‘8×5Ñ5°d·m±mÓDˆŒØr   N)rU   rV   rW   Ú__doc__r   r–   r˜   rœ   r   r   r   r   r   (  s3   „ ñð˜só òEð˜Sð ¨ð ¸ô r   c                   óN   — e Zd ZU dZedz  ed<   dedz  fd„Zd„ Zdeded	efd
„Z	y)ÚStreamContexta  Context-manager that selects a given stream.

    All MTIA kernels queued within its context will be enqueued on a selected
    stream.

    Args:
        Stream (Stream): selected stream. This manager is a no-op if it's
            ``None``.
    .. note:: Streams are per-device.
    NÚ
cur_streamr†   c                 óÀ  — d | _         || _        t        d d«      | _        t        j
                  j                  «       s| j                  €d| _        t        j
                  j                  «       sd nt        j                  j                  d «      | _	        t        j
                  j                  «       sd | _
        y t        j                  j                  d «      | _
        y )NTr   )r    r†   r   r“   r6   ÚjitÚis_scriptingr^   rn   Úsrc_prev_streamÚdst_prev_stream)r•   r†   s     r   r–   zStreamContext.__init__L  s¤   € ØˆŒØˆŒÜ$ T¨4Ó0ˆŒÜ�y‰y×%Ñ%Ô'Ø�x‰xÐØ�”ô Ÿ	™	×.Ñ.Ô0‰D´e·j±j×6OÑ6OÐPTÓ6Uð 	Ôô Ÿ	™	×.Ñ.Ô0ˆDð 	ÕÜ6;·j±j×6OÑ6OÐPTÓ6Uð 	Õr   c                 ó¼  — | j                   }|�| j                  dk(  ry t        j                  j	                  d «      | _        | j
                  j                  |j                  k7  rLt        |j                  «      5  t        j                  j	                  |j                  «      | _        d d d «       t        j                  j                  |«       y # 1 sw Y   Œ)xY w©Nr   )	r†   r“   r6   r^   rk   r¤   r   r¥   rŠ   )r•   r    s     r   r˜   zStreamContext.__enter__[  s§   € à—[‘[ˆ
àÐ §¡¨R¢ØÜ$Ÿz™z×8Ñ8¸Ó>ˆÔð ×Ñ×&Ñ&¨*×*;Ñ*;Ò;Ü˜
×)Ñ)Ó*ñ TÜ',§z¡z×'@Ñ'@À×ARÑARÓ'S�Ô$÷Tä�
‰
×Ñ˜jÕ)÷Tð Tús   Á;/CÃCr™   rš   r.   c                 ó*  — | j                   }|�| j                  dk(  ry | j                  j                  |j                  k7  r)t        j
                  j                  | j                  «       t        j
                  j                  | j                  «       y r§   )r†   r“   r¤   r   r6   r^   rŠ   r¥   )r•   r™   rš   r.   r    s        r   rœ   zStreamContext.__exit__j  sj   € à—[‘[ˆ
àÐ §¡¨R¢Øð ×Ñ×&Ñ&¨*×*;Ñ*;Ò;Ü�J‰J×!Ñ! $×"6Ñ"6Ô7Ü�
‰
×Ñ˜d×2Ñ2Õ3r   )
rU   rV   rW   r�   ÚStreamÚ__annotations__r–   r˜   r   rœ   r   r   r   rŸ   rŸ   >  sB   … ñ	ð ˜‘Óð
˜v¨™}ó 
ò*ð4˜Sð 4¨ð 4¸ô 4r   rŸ   c                 óF   — t         j                  j                  | ||«       y)zæset stream specified by the stream id, device index and
        device type

    Args: stream_id (int): stream id in stream pool
          device_index (int): device index in topo
          device_type (int): enum device type
    N)r6   r7   Ú_mtia_setStream)Ú	stream_idÚdevice_indexÚdevice_types      r   Ú_set_stream_by_idr°   x  s   € ô 
‡H�H×Ñ˜Y¨°kÕBr   c                 ó   — t        | «      S )a,  Wrap around the Context-manager StreamContext that selects a given stream.

    Arguments:
        stream (Stream): selected stream. This manager is a no-op if it's
            ``None``.
    .. note:: In eager mode stream is of type Stream class while in JIT it doesn't support torch.mtia.stream
    )rŸ   r‰   s    r   r†   r†   ƒ  s   € ô ˜Ó Ð r   c                 óz   — t        «        t        | d¬«      }|€
t        «       }t        |   }|j	                  «       S )a[  Returns the random number generator state of the specified MTIA device as a ByteTensor.

    Args:
        device (torch.device or int, optional): The device to return the RNG state of.
            Default: ``'mtia'`` (i.e., ``torch.device('mtia')``, the current mtia device).

    .. warning::
        This function eagerly initializes MTIA.
    Trg   )r!   r   re   r   Ú	get_state)r   r“   Údefault_generators      r   Úget_rng_staterµ   Ž  s<   € ô „LÜ
˜F¨TÔ
2€CØ
€{ÜÓˆÜ*¨3Ñ/ÐØ×&Ñ&Ó(Ð(r   c                  ób   — t        t        «       «      D � cg c]  } t        | «      ‘Œ }} |S c c} w )zRReturns a list of ByteTensor representing the random number states of all devices.)Úranger[   rµ   )ÚiÚresultss     r   Úget_rng_state_allrº      s,   € ä).¬|«~Ó)>Ö? AŒ}˜QÕÐ?€GÐ?Ø€Nùò @s   –,Ú	new_statec                 ó  ‡ ‡— t        «       sGt        j                  j                  «       5  ‰ j	                  t        j
                  ¬«      Š ddd«       t        |d¬«      Š‰€
t        «       Šˆˆ fd„}t        |«       y# 1 sw Y   Œ4xY w)a8  Sets the random number generator state of the specified MTIA device.

    Args:
        new_state (torch.ByteTensor): The desired state
        device (torch.device or int, optional): The device to set the RNG state.
            Default: ``'mtia'`` (i.e., ``torch.device('mtia')``, the current mtia device).
    )Úmemory_formatNTrg   c                  ó:   •— t         ‰   } | j                  ‰«       y r    )r   Ú	set_state)r´   r“   r»   s    €€r   Úcbzset_rng_state.<locals>.cb¸  s   ø€ Ü.¨sÑ3ÐØ×#Ñ# IÕ.r   )	r&   r6   r7   Ú_DisableFuncTorchÚcloneÚcontiguous_formatr   re   r4   )r»   r   rÀ   r“   s   `  @r   Úset_rng_staterÄ   ¦  su   ù€ ô ÔÜ�X‰X×'Ñ'Ó)ñ 	Oð "Ÿ™´e×6MÑ6M˜ÓNˆI÷	Oô
 ˜F¨TÔ
2€CØ
€{ÜÓˆõ/ô ˆr…N÷	Oð 	Oús   «!A?Á?BÚ
new_statesc                 óB   — t        | «      D ]  \  }}t        ||«       Œ y)zœSets the random number generator state of all devices.

    Args:
        new_states (Iterable of torch.ByteTensor): The desired state for each device.
    N)Ú	enumeraterÄ   )rÅ   r¸   Ústates      r   Úset_rng_state_allrÉ   ¿  s&   € ô ˜jÓ)ò  ‰ˆˆ5Ü�e˜QÕñ r   r)   c                 ó@   ‡ — t        ‰ «      Š ˆ fd„}t        |d¬«       y)a‘  Sets the seed for generating random numbers for the current MTIA device.
    It's safe to call this function if MTIA is not available; in that case, it is silently ignored.

    Args:
        seed (int): The desired seed.

    .. warning::
        If you are working with a multi-GPU model, this function is insufficient
        to get determinism.  To seed all GPUs, use :func:`manual_seed_all`.
    c                  óN   •— t        «       } t        |    }|j                  ‰«       y r    )re   r   Úmanual_seed)r“   r´   r)   s     €r   rÀ   zmanual_seed.<locals>.cbÖ  s$   ø€ ÜÓˆÜ.¨sÑ3ÐØ×%Ñ% dÕ+r   T©r)   N©Úintr4   ©r)   rÀ   s   ` r   rÌ   rÌ   É  s   ø€ ô ˆt‹9€Dô,ô
 ˆr˜Ör   c                 ó@   ‡ — t        ‰ «      Š ˆ fd„}t        |d¬«       y)zÚSets the seed for generating random numbers on all MTIA devices.
    It's safe to call this function if MTIA is not available; in that case, it is silently ignored.

    Args:
        seed (int): The desired seed.
    c                  ój   •— t        t        «       «      D ]  } t        |    }|j                  ‰«       Œ y r    )r·   r[   r   rÌ   )r¸   r´   r)   s     €r   rÀ   zmanual_seed_all.<locals>.cbç  s2   ø€ Ü”|“~Ó&ò 	0ˆAÜ 2°1Ñ 5ÐØ×)Ñ)¨$Õ/ñ	0r   T©r(   NrÎ   rÐ   s   ` r   Úmanual_seed_allrÔ   Þ  s   ø€ ô ˆt‹9€Dô0ô
 ˆr˜DÖ!r   c                  ó"   — d„ } t        | d¬«      S )ax  Sets the seed for generating random numbers to a random number for the current MTIA device.
    It's safe to call this function if MTIA is not available; in that case, it is silently ignored.

    .. warning::
        If you are working with a multi-GPU model, this function will only initialize
        the seed on one GPU.  To initialize all GPUs, use :func:`seed_all`.
    c                  óH   — t        «       } t        |    }|j                  «       S r    )re   r   r)   )r“   r´   s     r   rÀ   zseed.<locals>.cbø  s$   € ÜÓˆÜ.¨sÑ3ÐØ ×%Ñ%Ó'Ð'r   TrÍ   ©r4   ©rÀ   s    r   r)   r)   ï  s   € ò(ô
 �b˜tÔ$Ð$r   c                  ó"   — d„ } t        | d¬«      S )z½Sets the seed for generating random numbers to a random number on all MTIA devices.

    It's safe to call this function if MTIA is not available; in that case, it is silently ignored.
    c                  óœ   — d} d}t        t        «       «      D ]1  }t        |   }|s|j                  «       } d}Œ!|j	                  | «       Œ3 | S )Nr   FT)r·   r[   r   r)   rÌ   )Úrandom_seedÚseededr¸   r´   s       r   rÀ   zseed_all.<locals>.cb  sY   € ØˆØˆÜ”|“~Ó&ò 	;ˆAÜ 2°1Ñ 5ÐÙØ/×4Ñ4Ó6�Ø‘à!×-Ñ-¨kÕ:ð	;ð Ðr   TrÓ   r×   rØ   s    r   r(   r(      s   € ò
ô �b 4Ô(Ð(r   c                  óX   — t        «        t        «       } t        |    j                  «       S )z‚Returns the current random seed of the current MTIA device.

    .. warning::
        This function eagerly initializes MTIA.
    )r!   re   r   Úinitial_seed)r“   s    r   rÞ   rÞ     s%   € ô „LÜ
Ó
€CÜ˜cÑ"×/Ñ/Ó1Ð1r   )Ú*)#r"   r\   r&   r`   r[   re   rk   rn   Úmemory_statsÚmax_memory_allocatedÚmemory_allocatedÚreset_peak_memory_statsr�   r�   rt   rw   r{   r…   r�   rŠ   r†   r   rÄ   rµ   rÉ   rº   rÌ   rÔ   r)   r(   rÞ   r~   Ú	MTIAGraphÚgraphÚgraph_pool_handle)r   Nr    )ÚallÚpythonr   )T)r^   )Qr�   Ú	threadingr.   Úcollections.abcr   Útypingr   r6   r   Útorch._environmentr   r   Útorch._utilsr   Útorch.typesr	   Ú_utilsr   ÚEventr©   r   Útupler7   Ú	Generatorrª   r$   r   ÚlistrL   ÚlocalrB   ÚLockr*   r,   rA   r   r   rÏ   r   r   r"   r&   r4   Úboolr%   r!   rK   rN   rC   r\   r`   r[   re   rk   rn   rt   Údictrw   r{   r~   r�   r…   rŠ   r�   r�   r   rŸ   r°   r†   rµ   rº   rÄ   rÉ   rÌ   rÔ   r)   r(   rÞ   ÚmemoryÚ
mtia_graphÚ__all__r   r   r   ú<module>rû      s‚  ðòó Û Ý $Ý ã Ý ß 1Ý )Ý å %ð 	�‰€Ø	�‰€ð 68Ð �E˜%Ÿ(™(×,Ñ,¨cÐ1Ñ2Ó 7ð €ð ð ˆtØ	ˆ(�2�t�8Ñ
˜d 3™iÐ
'Ñ(ñó ð €y‡�Ó€Ø%�y—~‘~Ó'Ð Ù%Ó'Ð ñ ˆ5�8‰8Ð+Ô,Ø—x‘x×4Ñ4ÑðH ð H¨ó Hñ ˆ5�8‰8Ð0Ô1Ø"ŸX™X×?Ñ?ÑðH sð H¨só Hòò2ò
Kð(˜ó (ó;ô|	˜Iô 	ð$�dó $ð
�dó ñ2˜ð 2¨$ó 2ð+�có +ð
&˜ó &ñ
7˜6ð 
7¨Vó 
7ñ	U˜6ð 	U¨Vó 	Uð MNñEØ�4‰ZðEØ),ðEØFIðEà	óEð&+�$�s˜C�x‘.ó +ð7Ø˜˜S # sÐ+¨TÐ1Ñ2ð7à	ó7ñ¨4ó ñ
X &ð X°E¸#¸s¸(±Oó Xó'ð
,�vó ,ð
)�vð 
) $ó 
)ñX &ð X°D¸¸c¸±Nó X÷ñ ÷,74ñ 74òtCð!�6˜D‘=ð ! ]ó !ñ)˜&ð )¨fó )ð$˜4 ™<ó ñ˜Vð ¨Vð Àó ð2  $ v¡,ð  °4ó  ð�cð ˜dó ð*"˜#ð " $ó "ð"%ˆcó %ð")�#ó )ð*2�có 2ô Ü ò$�r   