L i}UddlZddlmZddlZddlmZddlmZmZm Z ddl m Z da eejed<ejddZGd d e Zd Zd Zy) N)Optional)_len_torch_function_stack) _pop_mode _push_modeTorchFunctionModecontext_decoratorCURRENT_DEVICEchtjtjtjtjtj tj tjtjtjtjjtjjtjtjtjtj tj"tj$tj&j(tj*tj,tj.tj0tj2tj4tj6tj8tj:tj<tj>tj@tjBtjDtjFtjHtjJtjLSN)'torchemptyempty_permuted empty_stridedempty_quantizedonesarangebartlett_windowblackman_windoweyefftfftfreqrfftfreqfullhamming_window hann_window kaiser_windowlinspacelogspacenested nested_tensorrandrandnrandintrandpermrangesparse_coo_tensorsparse_compressed_tensorsparse_csr_tensorsparse_csc_tensorsparse_bsr_tensorsparse_bsc_tensor tril_indices triu_indiceszerosasarraytensor as_tensor scalar_tensorY/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/utils/_device.py_device_constructorsr8sF)  )  )   )   )   )   )  )  )   )   )   )   )  )  )  !) " #) $ %) &  ""') ,  -) .  /) 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) )r6c&eZdZdZdZdZddZy) DeviceContextc8tj||_yr )rdevice)selfr<s r7__init__zDeviceContext.__init__>sll6* r6ct|_|jatt Dcgc] }t }}t |t|D] }t |ycc}wr )r old_devicer<r'rrrreversed)r=_ cur_stackmodes r7 __enter__zDeviceContext.__enter__As\( +00I0K*LMQY[M M4Y' D t   NsA'c8|jag}ttdz D]/}t }t |t rJ|j|1tdkDrt }t |t sJt|D] }t|y)Nr r) r@r r'rr isinstancer:appendrAr)r=exc_typeexc_valexc_tbrCrBrDs r7__exit__zDeviceContext.__exit__Ps 02Q67 #A;D!$ 6 66   T " # % & *;DdM2 22Y' D t  r6Ncv|xsi}|tvr |jd|j|d<||i|S)Nr<)r8getr<)r=functypesargskwargss r7__torch_function__z DeviceContext.__torch_function__csC2 ') )fjj.B.J#{{F8 T$V$$r6)r5N)__name__ __module__ __qualname__r>rErLrSr5r6r7r:r:=s+ &%r6r:c"tfd|S)NcSr r5r<sr7z"device_decorator..lsVr6r)r<rOs` r7device_decoratorr[ks ^T 22r6cfdS)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)``. cBttj|Sr )r[rr<)rOr<s r7rZzset_device..vs(f)=tDr6r5rYs`r7 set_devicer^os  EDr6) functoolstypingrrtorch._Crtorch.overridesrrrtorch.utils._contextlibr r r<__annotations__ lru_cacher8r:r[r^r5r6r7rfsj .DD5*.&-Q**\*%%*%\3Er6