o
     Õj›
  ã                   @   sŒ   d dl m Z mZmZ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mZ ddlmZ ddlmZmZ g d¢Zdd
d„Zddd„Zd	S )é   )Ú	auto_castÚdecorateÚ	amp_guardÚamp_decorate)Ú
white_listÚ
black_list)Ú	debuggingÚgrad_scalerÚaccuracy_compare)Ú
GradScalerÚ	AmpScalerÚOptimizerStateé    )Úcore)Ú_current_expected_placeÚ_get_paddle_place)r   r   r   Úis_float16_supportedÚis_bfloat16_supportedNc                 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   ©Zdevice© r   úT/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddle/amp/__init__.pyr   5   ó
   ÿý
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   P   r   r   )N)r   r   r   r   Z	amp_listsr   r   Ú r   r	   r
   r   r   r   Zpaddle.baser   Zpaddle.base.frameworkr   r   Ú__all__r   r   r   r   r   r   Ú<module>   s   
	