ó
    EñiW  ã                   óL  • S SK r S SKrS SKJr  S SKrS SKJr  S\R                  SS4S jrS\R                  4S jr	S\R                  R                  4S jrS\R                  R                  4S	 jrS\4S
 jrSS jrS\4S jrSq\ R$                       SS\4S jj5       rg)é    N)Ú	Generator)Údefault_generatorÚ	new_stateÚreturnc                 ó0   • [         R                  " U 5        g)zçSets the random number generator state.

.. note:: This function only works for CPU. For CUDA, please use
    :func:`torch.manual_seed`, which works for both CPU and CUDA.

Args:
    new_state (torch.ByteTensor): The desired state
N)r   Ú	set_state)r   s    ÚI/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/random.pyÚset_rng_stater
   
   s   € ô ×Ò 	Õ*ó    c                  ó,   • [         R                  " 5       $ )zµReturns the random number generator state as a `torch.ByteTensor`.

.. note:: The returned state is for the default generator on CPU only.

See also: :func:`torch.random.fork_rng`.
)r   Ú	get_state© r   r	   Úget_rng_stater      s   € ô ×&Ò&Ó(Ð(r   c                 ó   • [        U 5      $ )aƒ  Sets the seed for generating random numbers on all devices. Returns a
`torch.Generator` object.

Args:
    seed (int): The desired seed. Value must be within the inclusive range
        `[-0x8000_0000_0000_0000, 0xffff_ffff_ffff_ffff]`. Otherwise, a RuntimeError
        is raised. Negative inputs are remapped to positive values with the formula
        `0xffff_ffff_ffff_ffff + seed`.
)Ú_manual_seed_impl)Úseeds    r	   Úmanual_seedr       s   € ô ˜TÓ"Ð"r   c                 óJ  • [        U 5      n SS KnUR                  R                  5       (       d  UR                  R	                  U 5        SS KnUR                  R                  5       (       d  UR                  R                  U 5        SS KnUR                  R                  5       (       d  UR                  R	                  U 5        SS K
nUR                  R                  5       (       d  UR                  R	                  U 5        [        U 5        [        R                  " U 5      $ )Nr   )ÚintÚ
torch.cudaÚcudaÚ_is_in_bad_forkÚmanual_seed_allÚ	torch.mpsÚmpsr   Ú	torch.xpuÚxpuÚ
torch.mtiaÚmtiaÚ_seed_custom_devicer   ©r   Útorchs     r	   r   r   -   sÄ   € Üˆt‹9€DÛà�:‰:×%Ñ%×'Ñ'Ø�
‰
×"Ñ" 4Ô(ãà�9‰9×$Ñ$×&Ñ&Ø�	‰	×Ñ˜dÔ#ãà�9‰9×$Ñ$×&Ñ&Ø�	‰	×!Ñ! $Ô'ãà�:‰:×%Ñ%×'Ñ'Ø�
‰
×"Ñ" 4Ô(ä˜Ôä×(Ò(¨Ó.Ð.r   c                  ó6  • [         R                  " 5       n SSKnUR                  R	                  5       (       d  UR                  R                  U 5        SSKnUR                  R	                  5       (       d  UR                  R                  U 5        SSK	nUR                  R	                  5       (       d  UR                  R                  U 5        SSKnUR                  R	                  5       (       d  UR                  R                  U 5        [        U 5        U $ )z�Sets the seed for generating random numbers to a non-deterministic
random number on all devices. Returns a 64 bit number used to seed the RNG.
r   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   s     r	   r   r   H   s¿   € ô ×!Ò!Ó#€DÛà�:‰:×%Ñ%×'Ñ'Ø�
‰
×"Ñ" 4Ô(ãà�9‰9×$Ñ$×&Ñ&Ø�	‰	×Ñ˜dÔ#ãà�9‰9×$Ñ$×&Ñ&Ø�	‰	×!Ñ! $Ô'ãà�:‰:×%Ñ%×'Ñ'Ø�
‰
×"Ñ" 4Ô(ä˜Ôà€Kr   c                 ó˜  • [        U 5      n [        R                  R                  5       n[	        [        U5      (       aŒ  [        [        U5      nSnSn[	        X#5      (       a8  [	        X$5      (       a(  [        X#5      " 5       (       d  [        X$5      " U 5        ggSU S3nUSU SU SU S3-  n[        R                  " U[        S	S
9  gg)z�Sets the seed to generate random numbers for custom device.

Args:
    seed (int): The desired seed.

See [Note: support the custom device with privateuse1]
r   r   zSet seed for `z0` device does not take effect, please add API's Ú`z` and `z` to `z` device module.é   ©Ú
stacklevelN)	r   r"   Ú_CÚ_get_privateuse1_backend_nameÚhasattrÚgetattrÚwarningsÚwarnÚUserWarning)r   Úcustom_backend_nameÚcustom_device_modÚ_bad_fork_nameÚ_seed_all_nameÚmessages         r	   r    r    f   sÒ   € ô ˆt‹9€DÜŸ(™(×@Ñ@ÓBÐÜŒuÐ)×*Ñ*Ü#¤EÐ+>Ó?ÐØ*ˆØ*ˆÜÐ$×5Ñ5¼'Ø÷;
ñ ;
ô Ð,Ô=×?Ñ?ÜÐ)Ô:¸4Õ@ð @ð 'Ð':Ð&;Ð;kÐlˆGØ˜˜>Ð*¨'°.Ð1AÀÐH[ÐG\Ð\lÐmÑmˆGÜ�MŠM˜'¤;¸1Ó=ð +r   c                  ó,   • [         R                  " 5       $ )z’Returns the initial seed for generating random numbers as a
Python `long`.

.. note:: The returned seed is for the default generator on CPU only.
)r   Úinitial_seedr   r   r	   r6   r6      s   € ô ×)Ò)Ó+Ð+r   Fc              #   óä  #   • US:X  a  Sv •  g[         R                  " U5      R                  n[        [         US5      nUc  [	        SU S3S-   5      eU(       d  Sv •  gU cÇ  UR                  5       nUS:”  aœ  [        (       d‘  UR                  5        SU SU S	UR                  5        S
UR                  5        SUR                  5        SUR                  5        SU SU SUR                  5        SU SU S3n[        R                  " USS9  Sq[        [        U5      5      n O[        U 5      n [         R                  " 5       nU  V	s/ s H  o•R                  U	5      PM     n
n	 Sv •  [         R                  " U5        [        X
5       H  u  p›UR                  X¹5        M     gs  sn	f ! [         R                  " U5        [        X
5       H  u  p›UR                  X¹5        M     f = f7f)aB  
Forks the RNG, so that when you return, the RNG is reset
to the state that it was previously in.

Args:
    devices (iterable of Device IDs): devices for which to fork
        the RNG. CPU RNG state is always forked. By default, :meth:`fork_rng` operates
        on all devices, but will emit a warning if your machine has a lot
        of devices, since this function will run very slowly in that case.
        If you explicitly specify devices, this warning will be suppressed
    enabled (bool): if ``False``, the RNG is not forked.  This is a convenience
        argument for easily disabling the context manager without having
        to delete it and unindent your Python code under it.
    device_type (str): device type str, default is `cuda`. As for supported device,
        see details in :ref:`accelerator<accelerators>`
ÚmetaNztorch has no module of `z`, you should register z,a module by `torch._register_device_module`.é   z reports that you have z& available devices, and you have used z_ without explicitly specifying which devices are being used. For safety, we initialize *every* zA device by default, which can be quite slow if you have a lot of z5s. If you know that you are only making use of a few z' devices, set the environment variable z_VISIBLE_DEVICES or the 'z' keyword argument of z° with the set of devices you are actually using. For example, if you are using CPU only, set device.upper()_VISIBLE_DEVICES= or devices=[]; if you are using device 0 only, set zb_VISIBLE_DEVICES=0 or devices=[0].  To initialize all devices and suppress this warning, set the 'z#' keyword argument to `range(torch.z.device_count())`.é   r'   T)r"   ÚdeviceÚtyper,   ÚRuntimeErrorÚdevice_countÚ_fork_rng_warned_alreadyÚupperr-   r.   ÚlistÚranger   r
   Úzip)ÚdevicesÚenabledÚ_callerÚ_devices_kwÚdevice_typeÚ
device_modÚnum_devicesr4   Úcpu_rng_stater;   Údevice_rng_statesÚdevice_rng_states               r	   Úfork_rngrN   ‹   s  é € ð2 �fÓÛØä—,’,˜{Ó+×0Ñ0€KÜœ ¨TÓ2€JØÑÜØ& { mÐ3JÐKØ<ñ=ó
ð 	
ö ÛØà�Ø ×-Ñ-Ó/ˆØ˜‹?×#;Ò#;à×$Ñ$Ó&Ð'Ð'>¸{¸mð L!Ø!( 	ð *5Ø5@×5FÑ5FÓ5HÐ4Ið J6Ø6A×6GÑ6GÓ6IÐ5Jð K(Ø(3×(9Ñ(9Ó(;Ð'<Ð<cØ×$Ñ$Ó&Ð'Ð'@ÀÀÐMcÐdkÐclð mð #×(Ñ(Ó*Ð+ð ,7Ø7B°mð D Ø +˜}Ð,>ð
@ð ô �MŠM˜'¨aÒ0Ø'+Ð$Ü”u˜[Ó)Ó*‰ô �w“-ˆä×'Ò'Ó)€MÙHOÓPÊ¸f×1Ñ1°&Ö9ÉÐÐPð?Ûä×Ò˜MÔ*Ü(+¨GÖ(GÑ$ˆFØ×$Ñ$Ð%5Ö>ò )Hùò Qøô
 	×Ò˜MÔ*Ü(+¨GÖ(GÑ$ˆFØ×$Ñ$Ð%5Ö>ò )Hüs+   ‚EG0ÅF+Å(G0Å+F0 Å/AG0Æ0=G-Ç-G0)r   N)NTrN   rD   r   )Ú
contextlibr-   Úcollections.abcr   r"   Útorch._Cr   ÚTensorr
   r   r)   r   r   r   r   r    r6   r?   ÚcontextmanagerrN   r   r   r	   Ú<module>rT      sÂ   ðã Û Ý %ã Ý &ð	+˜UŸ\™\ð 	+¨dô 	+ð)�u—|‘|ô )ð
#˜Ÿ™×+Ñ+ô 
#ð/˜uŸx™x×1Ñ1ô /ð6ˆcô ô<>ð2,�cô ,ð !Ð ð ×ÑàØØØØñM?ð ôM?ó ñM?r   