Ë
    g^(h,  ã                   ó  — d dl Z d dlZd dlmZ d dlZd dlmZ dej                  ddfd„Zdej                  fd„Z	dej                  j                  fd„Zdefd	„Zdd
„Zdefd„Zdae j"                  	 	 	 	 	 ddefd„«       Zy)é    N)Ú	Generator)Údefault_generatorÚ	new_stateÚreturnc                 ó.   — t        j                  | «       y)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    úJ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/random.pyÚset_rng_stater
   
   s   € ô ×Ñ 	Õ*ó    c                  ó*   — t        j                  «       S )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                 ó®  — t        | «      } ddl}|j                  j                  «       s|j                  j	                  | «       ddl}|j                  j                  «       s|j                  j                  | «       ddl}|j                  j                  «       s|j                  j	                  | «       t        | «       t        j                  | «      S )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`.
    r   N)ÚintÚ
torch.cudaÚcudaÚ_is_in_bad_forkÚmanual_seed_allÚ	torch.mpsÚmpsÚmanual_seedÚ	torch.xpuÚxpuÚ_seed_custom_devicer   ©ÚseedÚtorchs     r	   r   r       s•   € ô ˆt‹9€DÛà�:‰:×%Ñ%Ô'Ø�
‰
×"Ñ" 4Ô(ãà�9‰9×$Ñ$Ô&Ø�	‰	×Ñ˜dÔ#ãà�9‰9×$Ñ$Ô&Ø�	‰	×!Ñ! $Ô'ä˜Ôä×(Ñ(¨Ó.Ð.r   c                  óš  — t        j                  «       } ddl}|j                  j	                  «       s|j                  j                  | «       ddl}|j                  j	                  «       s|j                  j                  | «       ddl	}|j                  j	                  «       s|j                  j                  | «       t        | «       | S )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   s     r	   r   r   ?   sŽ   € ô ×!Ñ!Ó#€DÛà�:‰:×%Ñ%Ô'Ø�
‰
×"Ñ" 4Ô(ãà�9‰9×$Ñ$Ô&Ø�	‰	×Ñ˜dÔ#ãà�9‰9×$Ñ$Ô&Ø�	‰	×!Ñ! $Ô'ä˜Ôà€Kr   c                 ó|  — t        | «      } t        j                  j                  «       }t	        t        |«      rƒt        t        |«      }d}d}t	        ||«      r1t	        ||«      r% t        ||«      «       s t        ||«      | «       yyd|› d�}|d|› d|› d|› d�z  }t        j                  |t        d	¬
«       yy)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   X   sÐ   € ô ˆt‹9€DÜŸ(™(×@Ñ@ÓBÐÜŒuÐ)Ô*Ü#¤EÐ+>Ó?ÐØ*ˆØ*ˆÜÐ$ nÔ5¼'Ø˜~ô;
ð >”7Ð,¨nÓ=Ô?Ø:”Ð)¨>Ó:¸4Õ@ð @ð 'Ð':Ð&;Ð;kÐlˆGØ˜˜>Ð*¨'°.Ð1AÀÐH[ÐG\Ð\lÐmÑmˆGÜ�M‰M˜'¤;¸1Ö=ð +r   c                  ó*   — t        j                  «       S )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	   r1   r1   q   s   € ô ×)Ñ)Ó+Ð+r   Fc              #   óÀ  K  — |dk(  rd–— yt        j                  |«      j                  }t        t         |d«      }|€t	        d|› d�dz   «      ‚|sd–— y| €Á|j                  «       }|dkD  r—t        s‘|j                  «       › d|› d|› d	|j                  «       › d
|j                  «       › d|j                  «       › d|j                  «       › d|› d|› d|j                  «       › d|› d|› d�}t        j                  |«       dat        t        |«      «      } nt        | «      } t        j                  «       }| D �	cg c]  }	|j                  |	«      ‘Œ }
}		 d–— t        j                  |«       t        | |
«      D ]  \  }	}|j                  ||	«       Œ yc c}	w # t        j                  |«       t        | |
«      D ]  \  }	}|j                  ||	«       Œ w xY w­w)a‰  
    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 custom device,
            see details in [Note: support the custom device with privateuse1]
    Ú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())`.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_devicesr/   Úcpu_rng_stater5   Údevice_rng_statesÚdevice_rng_states               r	   Úfork_rngrH   }   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˜'Ô"Ø'+Ð$Ü”u˜[Ó)Ó*‰ô �w“-ˆä×'Ñ'Ó)€MØHOÖP¸f˜×1Ñ1°&Õ9ÐPÐÐPð?Ûä×Ñ˜MÔ*Ü(+¨GÐ5FÓ(Gò 	?Ñ$ˆFÐ$Ø×$Ñ$Ð%5°vÕ>ñ	?ùò Qøô
 	×Ñ˜MÔ*Ü(+¨GÐ5FÓ(Gò 	?Ñ$ˆFÐ$Ø×$Ñ$Ð%5°vÕ>ñ	?üs+   ‚D<GÄ>FÅGÅF ÅAGÆ=GÇG)r   N)NTrH   r>   r   )Ú
contextlibr(   Úcollections.abcr   r   Útorch._Cr   ÚTensorr
   r   r$   r   r   r   r   r1   r9   ÚcontextmanagerrH   r   r   r	   ú<module>rN      s¬   ðã Û Ý %ã Ý &ð	+˜UŸ\™\ð 	+¨dó 	+ð)�u—|‘|ó )ð/˜Ÿ™×+Ñ+ó /ð>ˆcó ó2>ð2,�có ,ð !Ð ð ×ÑàØØØØñM?ð òM?ó ñM?r   