ó
    "Eñi¢  ã                   ó*  • S SK Jr  S SKrS SKJr  SSKJrJrJrJrJ	r	  SS\
\-  \R                  -  S\4S jjrS\\   4S	 jrSS
\S\
\-  \R                  -  SS4S jjrS\\   SS4S jrS\
SS4S jrS\
SS4S jrSS jrSS jrS\
4S jr/ SQrg)é    )ÚIterableN)ÚTensoré   )Ú
_lazy_callÚ
_lazy_initÚcurrent_deviceÚdevice_countÚis_initializedÚdeviceÚreturnc                 óR  • [        5         [        U [        5      (       a  [        R                  " U 5      n O,[        U [
        5      (       a  [        R                  " SU 5      n U R                  nUc
  [        5       n[        R                  R                  U   nUR                  5       $ )a6  Return the random number generator state of the specified GPU as a ByteTensor.

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

.. warning::
    This function eagerly initializes XPU.
Úxpu)r   Ú
isinstanceÚstrÚtorchr   ÚintÚindexr   r   Údefault_generatorsÚ	get_state)r   ÚidxÚdefault_generators      ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/xpu/random.pyÚget_rng_stater   
   s{   € ô „LÜ�&œ#×ÑÜ—’˜fÓ%‰Ü	�FœC×	 Ñ	 Ü—’˜e VÓ,ˆØ
�,‰,€CØ
�{ÜÓˆÜŸ	™	×4Ñ4°SÑ9ÐØ×&Ñ&Ó(Ð(ó    c                  óh   • [        [        5       5       V s/ s H  n [        U 5      PM     nn U$ s  sn f )zQReturn 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                 ó¨  ^ ^• [        5       (       dD  [        R                  R                  5          T R	                  [        R
                  S9m SSS5        [        T[        5      (       a  [        R                  " T5      mO,[        T[        5      (       a  [        R                  " ST5      mSUU 4S jjn[        U5        g! , (       d  f       N{= f)a  Set the random number generator state of the specified GPU.

Args:
    new_state (torch.ByteTensor): The desired state
    device (torch.device or int, optional): The device to set the RNG state.
        Default: ``'xpu'`` (i.e., ``torch.device('xpu')``, the current XPU device).
)Úmemory_formatNr   c                  ó”   >• TR                   n U c
  [        5       n [        R                  R                  U    nUR                  T5        g ©N)r   r   r   r   r   Ú	set_state)r   r   r   r    s     €€r   ÚcbÚset_rng_state.<locals>.cb7   s<   ø€ Ø�l‰lˆØ‰;Ü Ó"ˆCÜ!ŸI™I×8Ñ8¸Ñ=ÐØ×#Ñ# IÕ.r   ©r   N)r
   r   Ú_CÚ_DisableFuncTorchÚcloneÚcontiguous_formatr   r   r   r   r   )r    r   r&   s   `` r   Úset_rng_stater-   &   s�   ù€ ô ×ÑÜ�X‰X×'Ñ'Õ)Ø!Ÿ™´e×6MÑ6M˜ÐNˆI÷ *ô �&œ#×ÑÜ—’˜fÓ%‰Ü	�FœC×	 Ñ	 Ü—’˜e VÓ,ˆ÷/ð /ô ˆr…N÷ *Õ)ús   °CÃ
CÚ
new_statesc                 óB   • [        U 5       H  u  p[        X!5        M     g)z�Set 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_allr2   A   s   € ô ˜jÖ)‰ˆÜ�eÖò *r   Úseedc                 ó@   ^ • [        T 5      m SU 4S jjn[        USS9  g)al  Set the seed for generating random numbers for the current GPU.

It's safe to call this function if XPU 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`.
Nc                  óv   >• [        5       n [        R                  R                  U    nUR	                  T5        g r$   )r   r   r   r   Úmanual_seed)r   r   r3   s     €r   r&   Úmanual_seed.<locals>.cbY   s.   ø€ ÜÓˆÜ!ŸI™I×8Ñ8¸Ñ=ÐØ×%Ñ% dÕ+r   T)r3   r(   ©r   r   ©r3   r&   s   ` r   r6   r6   K   s   ø€ ô ˆt‹9€D÷,ô
 ˆr˜Ór   c                 ó@   ^ • [        T 5      m SU 4S jjn[        USS9  g)zÁSet the seed for generating random numbers on all GPUs.

It's safe to call this function if XPU is not available; in that case, it is silently ignored.

Args:
    seed (int): The desired seed.
Nc                  ó–   >• [        [        5       5       H1  n [        R                  R                  U    nUR                  T5        M3     g r$   )r   r	   r   r   r   r6   )r   r   r3   s     €r   r&   Úmanual_seed_all.<locals>.cbk   s7   ø€ Ü”|“~Ö&ˆAÜ %§	¡	× <Ñ <¸QÑ ?ÐØ×)Ñ)¨$Ö/ò 'r   T)Úseed_allr(   r8   r9   s   ` r   Úmanual_seed_allr>   a   s   ø€ ô ˆt‹9€D÷0ô
 ˆr˜DÓ!r   c                  ó$   • SS jn [        U 5        g)a[  Set the seed for generating random numbers to a random number for the current GPU.

It's safe to call this function if XPU 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`.
Nc                  ór   • [        5       n [        R                  R                  U    nUR	                  5         g r$   )r   r   r   r   r3   ©r   r   s     r   r&   Úseed.<locals>.cb}   s+   € ÜÓˆÜ!ŸI™I×8Ñ8¸Ñ=ÐØ×ÑÕ r   r(   ©r   ©r&   s    r   r3   r3   s   s   € ô!ô
 ˆr…Nr   c                  ó$   • SS jn [        U 5        g)z«Set the seed for generating random numbers to a random number on all GPUs.

It's safe to call this function if XPU is not available; in that case, it is silently ignored.
Nc                  óò   • Sn Sn[        [        5       5       H\  n[        R                  R                  U   nU(       d$  UR                  5         UR                  5       n SnMK  UR                  U 5        M^     g )Nr   FT)r   r	   r   r   r   r3   Úinitial_seedr6   )Úrandom_seedÚseededr   r   s       r   r&   Úseed_all.<locals>.cb‹   sb   € ØˆØˆÜ”|“~Ö&ˆAÜ %§	¡	× <Ñ <¸QÑ ?ÐÞØ!×&Ñ&Ô(Ø/×<Ñ<Ó>�Ø’à!×-Ñ-¨kÖ:ò 'r   r(   rC   rD   s    r   r=   r=   …   s   € ô
;ô ˆr…Nr   c                  ó„   • [        5         [        5       n [        R                  R                  U    nUR                  5       $ )zlReturn the current random seed of the current GPU.

.. warning::
    This function eagerly initializes XPU.
)r   r   r   r   r   rG   rA   s     r   rG   rG   š   s5   € ô „LÜ
Ó
€CÜŸ	™	×4Ñ4°SÑ9ÐØ×)Ñ)Ó+Ð+r   )	r   r   r-   r2   r6   r>   r3   r=   rG   )r   r(   )Úcollections.abcr   r   r   Ú r   r   r   r	   r
   r   r   r   r   Úlistr   r-   r2   r6   r>   r3   r=   rG   Ú__all__© r   r   Ú<module>rQ      sÇ   ðå $ã Ý ç RÕ Rñ)˜# ™) e§l¡lÑ2ð )¸võ )ð,˜4 ™<ô ñ˜Vð ¨S°3©Y¸¿¹Ñ-Eð ÐRVõ ð6  (¨6Ñ"2ð  °tô  ð�cð ˜dô ð,"˜#ð " $ô "ô$ô$ð*	,�cô 	,ò
�r   