o
    ei                     @   s   d dl Z d dlZd dlmZ d dlmZ d dlZg dZededG dd dej	j
jZed	edd
d ZededdddddZededdd ZdS )    N)Any)
deprecated)autocast
custom_fwd
custom_bwdzk`torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.)categoryc                       s   e Zd ZdZejdk r"dejdfdedej	def fddZ
d	d
 Zdejdfdedej	def fddZ fddZdededef fddZ fddZ  ZS )r   zSee :class:`torch.autocast`.

    ``torch.cuda.amp.autocast(args...)`` is deprecated. Please use ``torch.amp.autocast("cuda", args...)`` instead.
    )      Tenableddtypecache_enabledc                    s   t  | S N)super__new__)clsr
   r   r   	__class__ f/var/www/addictedbytheproject.nl/epg/venv/lib/python3.10/site-packages/torch/cuda/amp/autocast_mode.pyr       s   zautocast.__new__c                 C   s   d S r   r   )r   r   r   r   __init_subclass__(   s   zautocast.__init_subclass__c                    s8   t j r|| _d| _|| _d S t jd|||d d S )Ncuda)r
   r   r   )torch_jit_internalis_scripting_enableddevice
fast_dtyper   __init__)selfr
   r   r   r   r   r   r   +   s   

zautocast.__init__c                    s   t j r| S t  S r   )r   r   r   r   	__enter__)r   r   r   r   r   :   s   

zautocast.__enter__exc_typeexc_valexc_tbc                    s   t j rd S t |||S r   )r   r   r   r   __exit__)r   r    r!   r"   r   r   r   r#   @   s   
zautocast.__exit__c                    s   t j r|S t |S r   )r   r   r   r   __call__)r   funcr   r   r   r$   E   s   
zautocast.__call__)__name__
__module____qualname____doc__sysversion_infor   float16boolr   r   r   r   r   r   r#   r$   __classcell__r   r   r   r   r      s6    
r   z`torch.cuda.amp.autocast_mode._cast(value, dtype)` is deprecated. Please use `torch.amp.autocast_mode._cast(value, 'cuda', dtype)` instead.c                 C   s   t jj| d|S )Nr   )r   ampautocast_mode_cast)valuer   r   r   r   r1   L   s   r1   z{`torch.cuda.amp.custom_fwd(args...)` is deprecated. Please use `torch.amp.custom_fwd(args..., device_type='cuda')` instead.)cast_inputsc                C   s   t jtjjdd| |dS )z
    ``torch.cuda.amp.custom_fwd(args...)`` is deprecated. Please use
    ``torch.amp.custom_fwd(args..., device_type='cuda')`` instead.
    r   device_typefwdr3   )	functoolspartialr   r/   r   r6   r   r   r   r   U   s   
r   z{`torch.cuda.amp.custom_bwd(args...)` is deprecated. Please use `torch.amp.custom_bwd(args..., device_type='cuda')` instead.c                 C   s   t jtjjdd| S )z
    ``torch.cuda.amp.custom_bwd(args...)`` is deprecated. Please use
    ``torch.amp.custom_bwd(args..., device_type='cuda')`` instead.
    r   r4   )r8   r9   r   r/   r   )bwdr   r   r   r   d   s   
r   r   )r8   r*   typingr   typing_extensionsr   r   __all__FutureWarningr/   r0   r   r1   r   r   r   r   r   r   <module>   s4   :

