a
    h                     @   s   d dl Z d dlmZ d dlmZ d dlZg dZ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_bwdc                       sp   e Zd ZdZededdejdfeej	ed fddZ
 fdd	Zeeed
 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.
    zk`torch.cuda.amp.autocast(args...)` is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.categoryTenableddtypecache_enabledc                    s8   t j r || _d| _|| _d S t jd|||d d S )Ncudar	   )torch_jit_internalis_scriptingZ_enabledZdeviceZ
fast_dtypesuper__init__)selfr
   r   r   	__class__ J/var/www/auris/lib/python3.9/site-packages/torch/cuda/amp/autocast_mode.pyr      s    
zautocast.__init__c                    s   t j r| S t  S N)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   1   s    
zautocast.__call__)__name__
__module____qualname____doc__r   FutureWarningr   float16boolr   r   r   r   r   r   __classcell__r   r   r   r   r      s    r   z`torch.cuda.amp.autocast_mode._cast(value, dtype)` is deprecated. Please use `torch.amp.autocast_mode._cast(value, 'cuda', dtype)` instead.r   c                 C   s   t jj| d|S )Nr   )r   ampautocast_mode_cast)valuer   r   r   r   r*   8   s    r*   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   Zdevice_typeZfwdr,   )	functoolspartialr   r(   r   r.   r   r   r   r   A   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   r-   )r/   r0   r   r(   r   )Zbwdr   r   r   r   P   s    
r   )N)r/   typingr   Ztyping_extensionsr   r   __all__r(   r)   r   r$   r*   r   r   r   r   r   r   <module>   s(   ,

