U
    ©Ê¹jß  ã                   @   s4   d dl mZ d dlZdgZG dd„ dejjjƒZdS )é    )ÚAnyNÚautocastc                       sd   e Zd ZdZ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   z‚
    See :class:`torch.autocast`.
    ``torch.cpu.amp.autocast(args...)`` is equivalent to ``torch.autocast("cpu", args...)``
    T©ÚenabledÚdtypeÚcache_enabledc                    s8   t j ¡ r || _d| _|| _d S tƒ jd|||d� d S )NÚcpur   )ÚtorchÚ_jit_internalÚis_scriptingZ_enabledZdeviceZ
fast_dtypeÚsuperÚ__init__)Úselfr   r   r   ©Ú	__class__© úZ/var/www/html/bwave/python/venv/lib/python3.8/site-packages/torch/cpu/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   (   s    
zautocast.__call__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Zbfloat16Úboolr   r   r   r   r   r   Ú__classcell__r   r   r   r   r      s   üü)Útypingr   r	   Ú__all__ÚampZautocast_moder   r   r   r   r   Ú<module>   s   