
    R j                         % S SK r S SKJr  S SKrS SKJr  S SKJrJrJ	r	  S SK
Jr  Sq\R                  S-  \S'   \ R                  " S5      S 5       r " S	 S
\	5      rS rS rg)    N)Optional)_len_torch_function_stack)	_pop_mode
_push_modeTorchFunctionModecontext_decoratorCURRENT_DEVICE   c                     1 [         R                  i[         R                  i[         R                  i[         R                  i[         R
                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  R                  i[         R                  R                  i[         R                  i[         R                  i[         R                  i[         R                   i[         R"                  i[         R$                  i[         R&                  R(                  i[         R*                  i[         R,                  i[         R.                  i[         R0                  i[         R2                  i[         R4                  i[         R6                  i[         R8                  i[         R:                  i[         R<                  i[         R>                  i[         R@                  i[         RB                  i[         RD                  i[         RF                  i[         RH                  i[         RJ                  i[         RL                  i$ N)'torchemptyempty_permutedempty_stridedempty_quantizedonesarangebartlett_windowblackman_windoweyefftfftfreqrfftfreqfullhamming_windowhann_windowkaiser_windowlinspacelogspacenestednested_tensorrandrandnrandintrandpermrangesparse_coo_tensorsparse_compressed_tensorsparse_csr_tensorsparse_csc_tensorsparse_bsr_tensorsparse_bsc_tensortril_indicestriu_indiceszerosasarraytensor	as_tensorscalar_tensor     d/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/torch/utils/_device.py_device_constructorsr8      sF   )) 	) 		)
 	) 	

) 	) 	) 	) 			) 			) 			) 	

) 	) 	)  	!)" 	#)$ 	%)& 	""'), 	

-). 	/)0 	1)2 	3)4 	5)6 	7)8 	&&9): 	;)< 	=)> 	?)@ 	A)B 	C)D 	E)F 	G)H 	I)L 	M)N 	O)P 	Q) )r6   c                   4    \ rS rSrSS jrS rS rS	S jrSrg)
DeviceContext=   Nc                 H    [         R                  " U5      U l        S U l        g r   )r   device	prev_mode)selfr=   s     r7   __init__DeviceContext.__init__>   s    ll6*26r6   c                    [         U l        U R                  q [        [	        5       5       Vs/ s H  n[        5       PM     nn[        U 5        [        U5       H+  n[        U[        5      (       a  X0l
        M   [        U5        M-     g s  snf r   )r
   
old_devicer=   r'   r   r   r   reversed
isinstancer:   r>   )r?   _	cur_stackmodes       r7   	__enter__DeviceContext.__enter__C   sl    (
 +00I0K*LM*LQY[*L	M4Y'D$..!%4 	 (	 Ns   B	c                    U R                   q/ n[        [        5       S-
  5       H>  n[	        5       n[        U[        5      (       a  [        S5      eUR                  U5        M@     [        5       S:  a*  [	        5       n[        U[        5      (       d  [        S5      eU R                  b  [        U R                  5        [        U5       H  n[        U5        M     g )Nr   z@Found nested DeviceContext on the mode stack where none expectedr   z8Expected a DeviceContext at the bottom of the mode stack)rC   r
   r'   r   r   rE   r:   AssertionErrorappendr>   r   rD   )r?   exc_typeexc_valexc_tbrG   rF   rH   s          r7   __exit__DeviceContext.__exit__U   s    	 02Q67A;D$..$V  T" 8 %&*;DdM22$N  >>%t~~&Y'Dt (r6   c                     U=(       d    0 nU[        5       ;   a!  UR                  S5      c  U R                  US'   U" U0 UD6$ )Nr=   )r8   getr=   )r?   functypesargskwargss        r7   __torch_function__ DeviceContext.__torch_function__p   sC    2'))fjj.B.J#{{F8T$V$$r6   )r=   rC   r>   )returnN)r5   N)	__name__
__module____qualname____firstlineno__r@   rI   rQ   rY   __static_attributes__r5   r6   r7   r:   r:   =   s    7
!$6%r6   r:   c                 $   ^  [        U 4S jU5      $ )Nc                     > T $ r   r5   r=   s   r7   <lambda>"device_decorator.<locals>.<lambda>y   s    Vr6   r   )r=   rU   s   ` r7   device_decoratorrf   x   s    ^T22r6   c                    ^  U 4S j$ )z
Set the default device inside of the wrapped function by decorating it with this function.

If you would like to use this as a context manager, use device as a
context manager directly, e.g., ``with torch.device(device)``.
c                 D   > [        [        R                  " T5      U 5      $ r   )rf   r   r=   )rU   r=   s    r7   rd   set_device.<locals>.<lambda>   s    (f)=tDr6   r5   rc   s   `r7   
set_devicerj   |   s     EDr6   )	functoolstypingr   r   torch._Cr   torch.overridesr   r   r   torch.utils._contextlibr	   r
   r=   __annotations__	lru_cacher8   r:   rf   rj   r5   r6   r7   <module>rr      sh       . D D 5 '+t# * Q* *\7%% 7%v3Er6   