Ë
    ßGìj	  ã                   ó   — d Z ddlZddlmZmZ ddlmZ ddlm	Z	m
Z
  G d„ d«      Zes"  e	ej                  j                  «      e«      Z G d„ d	«      Zes"  e	ej                  j                  «      e«      Zej                  j                  Zy)
z6`jax.experimental.transfer`: DCN cross slice transfer.é    N)ÚAnyÚTYPE_CHECKING)Ú
xla_client)Úuse_cpp_classÚuse_cpp_methodc                   ó>   — e Zd ZdZ e«       d„ «       Zdededefd„Zy)ÚTransferConnectionz,Represents a connection to exactly one peer.c                 ó   — t        «       ‚©N©ÚNotImplementedError)ÚselfÚuuidÚbackendÚxs_flats       ú]C:\Users\Stabi\Downloads\virtual-tryon(1)\venv\Lib\site-packages\jax/experimental/transfer.pyÚ
_pull_flatzTransferConnection._pull_flat   ó   € ä
Ó
Ðó    r   ÚxsÚreturnc                 óü   — t         j                  j                  |«      \  }}|s|S t        t	        |d   j
                  j                  «      «      j                  }|j                  | j                  |||«      «      S )z¹Fetches a pytree of arrays from a remote device.

    Args:
       uuid: identifier for the request
       xs: A pytree of ShapeDtypeStruct.
    Returns:
       A pytree of arrays.
    r   )
ÚjaxÚtreeÚflattenÚnextÚiterÚshardingÚ
device_setÚclientÚ	unflattenr   )r   r   r   r   r   r   s         r   ÚpullzTransferConnection.pull   se   € ô —H‘H×$Ñ$ RÓ(�M€GˆTÙØ€iÜ”4˜ ™
×+Ñ+×6Ñ6Ó7Ó8×?Ñ?€GØ�>‰>˜$Ÿ/™/¨$°¸ÓAÓBÐBr   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úintr   r"   © r   r   r	   r	      s8   „ Ù4áÓñ ó ð ðC�sð C ð C¨ô Cr   r	   c                   óž   — e Zd Z e«       defd„«       Z e«       deej                     fd„«       Z	 e«       dede
fd„«       Zdededefd	„Zy
)ÚTransferServerr   c                 ó   — t        «       ‚)z>Returns the address that this server can be connected to with.r   )r   s    r   ÚaddresszTransferServer.address2   ó   € ô Ó
Ðr   Úargsc                 ó   — t        «       ‚r   r   )r   r   r.   s      r   Ú_await_pull_flatzTransferServer._await_pull_flat7   r   r   r,   c                 ó   — t        «       ‚)z(Creates a connection to a remote server.r   )r   r,   s     r   ÚconnectzTransferServer.connect;   r-   r   r   Úarraysc                 óh   — | j                  |t        j                  j                  |«      d   «       y)z>Schedules a pytree of arrays to be fetched by a remote device.r   N)r0   r   r   r   )r   r   r3   s      r   Ú
await_pullzTransferServer.await_pull@   s&   € à×Ñ˜$¤§¡× 0Ñ 0°Ó 8¸Ñ ;Õ<r   N)r#   r$   r%   r   Ústrr,   Úlistr   ÚArrayr0   r	   r2   r'   r   r5   r(   r   r   r*   r*   0   s„   „ áÓð �sò  ó ð ñ Óð ¨¨c¯i©i©ò  ó ð ñ Óð ˜Sð  Ð%7ò  ó ð ð=˜Sð =¨#ð =°#ô =r   r*   )r&   r   Útypingr   r   Újax._src.libr   Ú_xcÚjax._src.utilr   r   r	   Ú_xlar*   Ústart_transfer_serverr(   r   r   Ú<module>r?      s~   ðñ =ã 
ß %Ý *ß 7÷Cñ Cñ. ØA‘} S§X¡X×%@Ñ%@ÓAÐBTÓUÐ÷=ñ =ñ* Ø9‘= §¡×!8Ñ!8Ó9¸.ÓI€.àŸ™×6Ñ6Ñ r   