ó
    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Q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g)é    )ÚIterableN)ÚTensoré   )Ú
_lazy_callÚ
_lazy_initÚcurrent_deviceÚdevice_countÚis_initialized)	Úget_rng_stateÚget_rng_state_allÚset_rng_stateÚset_rng_state_allÚmanual_seedÚmanual_seed_allÚseedÚseed_allÚinitial_seedÚ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       $ )a:  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: ``'cuda'`` (i.e., ``torch.device('cuda')``, the current CUDA device).

.. warning::
    This function eagerly initializes CUDA.
Úcuda)r   Ú
isinstanceÚstrÚtorchr   ÚintÚindexr   r   Údefault_generatorsÚ	get_state)r   ÚidxÚdefault_generators      ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/cuda/random.pyr   r      s{   € ô „LÜ�&œ#×ÑÜ—’˜fÓ%‰Ü	�FœC×	 Ñ	 Ü—’˜f fÓ-ˆØ
�,‰,€CØ
�{ÜÓˆÜŸ
™
×5Ñ5°cÑ:ÐØ×&Ñ&Ó(Ð(ó    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!   r   r   -   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UU 4S jn[        U5        g! , (       d  f       Ny= 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: ``'cuda'`` (i.e., ``torch.device('cuda')``, the current CUDA 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>.cbE   s<   ø€ Ø�l‰lˆØ‰;Ü Ó"ˆCÜ!ŸJ™J×9Ñ9¸#Ñ>ÐØ×#Ñ# IÕ.r"   )r
   r   Ú_CÚ_DisableFuncTorchÚcloneÚcontiguous_formatr   r   r   r   r   )r'   r   r-   s   `` r!   r   r   3   sŒ   ù€ ô ×ÑÜ�X‰X×'Ñ'Õ)ð "Ÿ™´e×6MÑ6M˜ÐNˆI÷ *ô �&œ#×ÑÜ—’˜fÓ%‰Ü	�FœC×	 Ñ	 Ü—’˜f fÓ-ˆö/ô ˆ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   )r3   r%   Ústates      r!   r   r   O   s   € ô ˜jÖ)‰ˆÜ�eÖò *r"   r   c                 ó<   ^ • [        T 5      m U 4S jn[        USS9  g)am  Set the seed for generating random numbers for the current GPU.

It's safe to call this function if CUDA 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                  óv   >• [        5       n [        R                  R                  U    nUR	                  T5        g r+   )r   r   r   r   r   )r   r    r   s     €r!   r-   Úmanual_seed.<locals>.cbh   s.   ø€ ÜÓˆÜ!ŸJ™J×9Ñ9¸#Ñ>ÐØ×%Ñ% dÕ+r"   T)r   N©r   r   ©r   r-   s   ` r!   r   r   Y   s   ø€ ô ˆt‹9€Dõ,ô
 ˆr˜Ór"   c                 ó<   ^ • [        T 5      m U 4S 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 CUDA is not available; in that
case, it is silently ignored.

Args:
    seed (int): The desired seed.
c                  ó–   >• [        [        5       5       H1  n [        R                  R                  U    nUR                  T5        M3     g r+   )r$   r	   r   r   r   r   )r%   r    r   s     €r!   r-   Úmanual_seed_all.<locals>.cb{   s7   ø€ Ü”|“~Ö&ˆAÜ %§
¡
× =Ñ =¸aÑ @ÐØ×)Ñ)¨$Ö/ò 'r"   T)r   Nr:   r;   s   ` r!   r   r   p   s   ø€ ô ˆt‹9€Dõ0ô
 ˆr˜DÓ!r"   c                  ó    • S 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 CUDA 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                  ór   • [        5       n [        R                  R                  U    nUR	                  5         g r+   )r   r   r   r   r   ©r   r    s     r!   r-   Úseed.<locals>.cbŽ   s+   € ÜÓˆÜ!ŸJ™J×9Ñ9¸#Ñ>ÐØ×ÑÕ r"   N©r   ©r-   s    r!   r   r   ƒ   s   € ò!ô
 ˆr…Nr"   c                  ó    • S 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 CUDA is not available; in that
case, it is silently ignored.
c                  óò   • 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   r   r   r   )Úrandom_seedÚseededr%   r    s       r!   r-   Úseed_all.<locals>.cb�   sb   € ØˆØˆÜ”|“~Ö&ˆAÜ %§
¡
× =Ñ =¸aÑ @ÐÞØ!×&Ñ&Ô(Ø/×<Ñ<Ó>�Ø’à!×-Ñ-¨kÖ:ò 'r"   NrC   rD   s    r!   r   r   –   s   € ò
;ô ˆr…Nr"   c                  ó„   • [        5         [        5       n [        R                  R                  U    nUR                  5       $ )zmReturn the current random seed of the current GPU.

.. warning::
    This function eagerly initializes CUDA.
)r   r   r   r   r   r   rA   s     r!   r   r   ¬   s5   € ô „LÜ
Ó
€CÜŸ
™
×5Ñ5°cÑ:ÐØ×)Ñ)Ó+Ð+r"   )r   )r   N)Úcollections.abcr   r   r   Ú r   r   r   r	   r
   Ú__all__r   r   r   r   Úlistr   r   r   r   r   r   r   r   © r"   r!   Ú<module>rP      sÇ   ðå $ã Ý ç RÕ Rò
€ñ)˜# ™) e§l¡lÑ2ð )Àõ )ð,˜4 ™<ô ñ˜Vð ¨S°3©Y¸¿¹Ñ-Eð ÐSWõ ð8  (¨6Ñ"2ð  °tô  ð�cð ˜dô ð."˜#ð " $ô "ô&ô&ð,	,�cõ 	,r"   