
    tii	                     h   U d dl mZ d dlZd dlmZ d dlmZ dee   fdZdee   fdZ	eeedz        Z
eed<   ee   Zeed	<   ej                  gZ e       	 dd
e
dedeeej$                  ej&                  f   ee
ef   f   fd       Zdej$                  defdZdee   dej$                  defdZy)    )	TypeAliasN)Tensor)no_gradreturnc                  F    dddt         j                  j                         gS )z:Return the device type list that supports foreach kernels.cudaxpumtiatorch_C_get_privateuse1_backend_name     `/home/ubuntu/crypto_trading_bot/.venv/lib/python3.12/site-packages/torch/utils/_foreach_utils.py&_get_foreach_kernels_supported_devicesr      s    E6588#I#I#KLLr   c                  L    ddddddt         j                  j                         gS )zEReturn the device type list that supports fused kernels in optimizer.mpsr   r	   hpucpur
   r   r   r   r   $_get_fused_kernels_supported_devicesr      s0     	..0 r   TensorListListIndicestensorlistlistwith_indicesc                 B    t         j                  j                  | |      S N)r   r   "_group_tensors_by_device_and_dtype)r   r   s     r   r   r   *   s    
 8866~|TTr   devicec                 x    | j                   t               dgz   v xr t        j                  j	                          S )Nr   )typer   r   jitis_scripting)r   s    r   _device_has_foreach_supportr$   2   s6    >@E7JK 	)		&&((r   tensorsc                 @    t        |      xr t        d | D              S )Nc              3   J   K   | ]  }|d u xs t        |      t        v   y wr   )r!   _foreach_supported_types).0ts     r   	<genexpr>z'_has_foreach_support.<locals>.<genexpr>:   s+      7=>T	8T!W 8887s   !#)r$   all)r%   r   s     r   _has_foreach_supportr-   9   s(    &v. 3 7BI7 4 r   )F)typingr   r   r   torch.autograd.grad_moder   liststrr   r   r   __annotations__intr   r(   booldicttupler   dtyper   r$   r-   r   r   r   <module>r8      s       ,MS	 M

d3i 
 !ftm!45	 5#Y !LL>  	 U"UU 
%ekk)
*E.'2I,J
JKU U  $v,   r   