§
    Pzni‡  ã                   ó   — d dl mZmZmZ d dlZddlmZ ddlmZmZm	Z	m
Z
 g d¢Zdd	eeeej        f         d
efd„Zd
ee         fd„Z	 dded	eeeej        f         d
dfd„Zdee         d
dfd„Zded
dfd„Zded
dfd„Zdd„Zdd„Zd
efd„ZdS )é    )ÚIterableÚListÚUnionNé   )ÚTensoré   )Ú
_lazy_callÚ
_lazy_initÚcurrent_deviceÚdevice_count)	Úget_rng_stateÚget_rng_state_allÚset_rng_stateÚset_rng_state_allÚmanual_seedÚmanual_seed_allÚseedÚseed_allÚinitial_seedÚcudaÚdeviceÚreturnc                 óJ  — t          ¦   «          t          | t          ¦  «        rt          j        | ¦  «        } n*t          | t
          ¦  «        rt          j        d| ¦  «        } | j        }|€t          ¦   «         }t          j        j	        |         }| 
                    ¦   «         S )aS  Returns 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.
    r   )r
   Ú
isinstanceÚstrÚtorchr   ÚintÚindexr   r   Údefault_generatorsÚ	get_state)r   ÚidxÚdefault_generators      úq/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/cuda/random.pyr   r      sŒ   € õ �L„L€LÝ�&�#ÑÔð .Ý”˜fÑ%Ô%ˆˆÝ	�F�CÑ	 Ô	 ð .Ý”˜f fÑ-Ô-ˆØ
Œ,€CØ
€{ÝÑÔˆÝœ
Ô5°cÔ:ÐØ×&Ò&Ñ(Ô(Ð(ó    c                  óŠ   — g } t          t          ¦   «         ¦  «        D ]$}|                      t          |¦  «        ¦  «         Œ%| S )zRReturns a list of ByteTensor representing the random number states of all devices.)Úranger   Úappendr   )ÚresultsÚis     r#   r   r   *   sF   € ð €GÝ•<‘>”>Ñ"Ô"ð )ð )ˆØ�Š•} QÑ'Ô'Ñ(Ô(Ð(Ð(Ø€Nr$   Ú	new_statec                 óˆ  ‡‡— t           j                             ¦   «         5  |                      t           j        ¬¦  «        Šddd¦  «         n# 1 swxY w Y   t          ‰t          ¦  «        rt          j        ‰¦  «        Šn*t          ‰t          ¦  «        rt          j        d‰¦  «        Šˆˆfd„}t          |¦  «         dS )a0  Sets 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                  óŽ   •— ‰j         } | €t          ¦   «         } t          j        j        |          }|                     ‰¦  «         d S ©N)r   r   r   r   r   Ú	set_state)r!   r"   r   Únew_state_copys     €€r#   Úcbzset_rng_state.<locals>.cbD   sD   ø€ ØŒlˆØˆ;Ý Ñ"Ô"ˆCÝ!œJÔ9¸#Ô>ÐØ×#Ò# NÑ3Ô3Ð3Ð3Ð3r$   )
r   Ú_CÚ_DisableFuncTorchÚcloneÚcontiguous_formatr   r   r   r   r	   )r*   r   r1   r0   s    ` @r#   r   r   3   s  øø€ õ 
Œ×	#Ò	#Ñ	%Ô	%ð Pð PØ"ŸšµuÔ7N˜ÑOÔOˆðPð Pð Pñ Pô Pð Pð Pð Pð Pð Pð Pøøøð Pð Pð Pð På�&�#ÑÔð .Ý”˜fÑ%Ô%ˆˆÝ	�F�CÑ	 Ô	 ð .Ý”˜f fÑ-Ô-ˆð4ð 4ð 4ð 4ð 4ð 4õ ˆr�N„N€N€N€Ns   ¡!AÁAÁAÚ
new_statesc                 óP   — t          | ¦  «        D ]\  }}t          ||¦  «         ŒdS )z–Sets the random number generator state of all devices.

    Args:
        new_states (Iterable of torch.ByteTensor): The desired state for each deviceN)Ú	enumerater   )r6   r)   Ústates      r#   r   r   N   s<   € õ
 ˜jÑ)Ô)ð  ð  ‰ˆˆ5Ý�e˜QÑÔÐÐð ð  r$   r   c                 óR   ‡ — t          ‰ ¦  «        Š ˆ fd„}t          |d¬¦  «         dS )a�  Sets 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                  ó|   •— t          ¦   «         } t          j        j        |          }|                     ‰¦  «         d S r.   )r   r   r   r   r   )r!   r"   r   s     €r#   r1   zmanual_seed.<locals>.cbe   s8   ø€ ÝÑÔˆÝ!œJÔ9¸#Ô>ÐØ×%Ò% dÑ+Ô+Ð+Ð+Ð+r$   T)r   N©r   r	   ©r   r1   s   ` r#   r   r   W   sD   ø€ õ ˆt‰9Œ9€Dð,ð ,ð ,ð ,ð ,õ
 ˆr˜ÐÑÔÐÐÐr$   c                 óR   ‡ — t          ‰ ¦  «        Š ˆ fd„}t          |d¬¦  «         dS )zÖSets 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                  óœ   •— t          t          ¦   «         ¦  «        D ].} t          j        j        |          }|                     ‰¦  «         Œ/d S r.   )r&   r   r   r   r   r   )r)   r"   r   s     €r#   r1   zmanual_seed_all.<locals>.cbw   sO   ø€ Ý•|‘~”~Ñ&Ô&ð 	0ð 	0ˆAÝ %¤
Ô =¸aÔ @ÐØ×)Ò)¨$Ñ/Ô/Ð/Ð/ð	0ð 	0r$   T)r   Nr<   r=   s   ` r#   r   r   m   sD   ø€ õ ˆt‰9Œ9€Dð0ð 0ð 0ð 0ð 0õ
 ˆr˜DÐ!Ñ!Ô!Ð!Ð!Ð!r$   c                  ó*   — d„ } t          | ¦  «         dS )at  Sets 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                  óx   — t          ¦   «         } t          j        j        |          }|                     ¦   «          d S r.   )r   r   r   r   r   ©r!   r"   s     r#   r1   zseed.<locals>.cb‰   s5   € ÝÑÔˆÝ!œJÔ9¸#Ô>ÐØ×ÒÑ Ô Ð Ð Ð r$   N©r	   ©r1   s    r#   r   r      s"   € ð!ð !ð !õ
 ˆr�N„N€N€N€Nr$   c                  ó*   — d„ } t          | ¦  «         dS )z¸Sets 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                  óü   — d} d}t          t          ¦   «         ¦  «        D ][}t          j        j        |         }|s+|                     ¦   «          |                     ¦   «         } d}ŒF|                     | ¦  «         Œ\d S )Nr   FT)r&   r   r   r   r   r   r   r   )Úrandom_seedÚseededr)   r"   s       r#   r1   zseed_all.<locals>.cb—   sŠ   € ØˆØˆÝ•|‘~”~Ñ&Ô&ð 	;ð 	;ˆAÝ %¤
Ô =¸aÔ @ÐØð ;Ø!×&Ò&Ñ(Ô(Ð(Ø/×<Ò<Ñ>Ô>�Ø��à!×-Ò-¨kÑ:Ô:Ð:Ð:ð	;ð 	;r$   NrC   rD   s    r#   r   r   ‘   s"   € ð
;ð 
;ð 
;õ ˆr�N„N€N€N€Nr$   c                  ó�   — t          ¦   «          t          ¦   «         } t          j        j        |          }|                     ¦   «         S )zzReturns the current random seed of the current GPU.

    .. warning::
        This function eagerly initializes CUDA.
    )r
   r   r   r   r   r   rB   s     r#   r   r   ¦   s:   € õ �L„L€LÝ
Ñ
Ô
€CÝœ
Ô5°cÔ:ÐØ×)Ò)Ñ+Ô+Ð+r$   )r   )r   N)Útypingr   r   r   r   Ú r   r	   r
   r   r   Ú__all__r   r   r   r   r   r   r   r   r   r   r   r   © r$   r#   ú<module>rN      sÅ  ðØ (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (à €€€Ø Ð Ð Ð Ð Ð Ø BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ BÐ Bð
ð 
ð 
€ð)ð )˜%  S¨%¬,Ð 6Ô7ð )ÀVð )ð )ð )ð )ð,˜4 œ<ð ð ð ð ð @Fðð ØðØ$ S¨#¨u¬|Ð%;Ô<ðà	ðð ð ð ð6  (¨6Ô"2ð  °tð  ð  ð  ð  ð�cð ˜dð ð ð ð ð,"˜#ð " $ð "ð "ð "ð "ð$ð ð ð ð$ð ð ð ð*	,�cð 	,ð 	,ð 	,ð 	,ð 	,ð 	,r$   