o
    û* iã  ã                   @  s¬   d dl mZ d dlmZ d dlmZmZ ddlmZm	Z	m
Z
 ddlmZmZ ddlmZmZmZmZmZmZ ddl
mZmZmZ g d	¢ZeZeZdddd„Zdddd„Zd
S )é    )Úannotations)Úcore)Ú_current_expected_placeÚ_get_paddle_placeé   )Úaccuracy_compareÚ	debuggingÚgrad_scaler)Ú
black_listÚ
white_list)Úamp_decorateÚ	amp_guardÚ	auto_castÚdecorateÚget_autocast_dtypeÚis_autocast_enabled)Ú	AmpScalerÚ
GradScalerÚOptimizerState)	r   r   r   Úis_float16_supportedÚis_bfloat16_supportedr   r   Úget_autocast_cpu_dtypeÚget_autocast_gpu_dtypeNÚdeviceú
str | NoneÚreturnÚboolc                 C  ó    | du rt ƒ nt| ƒ} t | ¡S )a  
    Determine whether the place supports float16 in the auto-mixed-precision training.

    Args:
        device (str|None, optional): Specify the running device.
            It can be ``cpu``, ``gpu``, ``xpu``, ``gpu:x`` and ``xpu:x``,
            where ``x`` is the index of the GPUs or XPUs. if device is None, the device is the current device. Default: None.

    Examples:

        .. code-block:: python

            >>> import paddle
            >>> paddle.amp.is_float16_supported() # True or False
            False
    N)r   r   r   r   ©r   © r   ú_/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/paddle/amp/__init__.pyr   =   ó
   ÿý
r   c                 C  r   )a  
    Determine whether the place supports bfloat16 in the auto-mixed-precision training.

    Args:
        device (str|None, optional): Specify the running device.
            It can be ``cpu``, ``gpu``, ``xpu``, ``gpu:x`` and ``xpu:x``,
            where ``x`` is the index of the GPUs or XPUs. if device is None, the device is the current device. Default: None.

    Examples:

        .. code-block:: python

            >>> import paddle
            >>> paddle.amp.is_bfloat16_supported() # True or False
            True
    N)r   r   r   r   r   r   r   r    r   X   r!   r   )N)r   r   r   r   )Ú
__future__r   Zpaddle.baser   Zpaddle.base.frameworkr   r   Ú r   r   r	   Z	amp_listsr
   r   r   r   r   r   r   r   r   r   r   Ú__all__r   r   r   r   r   r   r   r    Ú<module>   s    