o
    "j                     @   sD   d dl mZ d dlmZ dgZeddddddd
dZdd Zd	S )    )core)
deprecatedsynchronizez2.5.0zpaddle.device.synchronize   z:synchronize in paddle.device.xpu will be removed in future)ZsinceZ	update_tolevelreasonNc                 C   sD   d}| durt | tr| }nt | tjr|  }ntdt|S )aB  
    Wait for the compute on the given XPU device to finish.

    Parameters:
        device(paddle.XPUPlace()|int, optional): The device or the ID of the device.
        If device is None, the device is the current device. Default: None.

    Examples:
        .. code-block:: python

            >>> # doctest: +REQUIRES(env:XPU)
            >>> import paddle
            >>> paddle.device.set_device('xpu')
            >>> paddle.device.xpu.synchronize()
            >>> paddle.device.xpu.synchronize(0)
            >>> paddle.device.xpu.synchronize(paddle.XPUPlace(0))

    Nz*device type must be int or paddle.XPUPlace)
isinstanceintr   ZXPUPlaceZget_device_id
ValueErrorZ_xpu_device_synchronize)ZdeviceZ	device_id r   [/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddle/device/xpu/__init__.pyr      s   


c                  C   s   t tdrt } | S d} | S )z
    Return the number of XPUs available.

    Returns:
        int: the number of XPUs available.

    Examples:
        .. code-block:: python

            >>> import paddle

            >>> paddle.device.xpu.device_count()

    get_xpu_device_countr   )hasattrr   r   )Znum_xpusr   r   r   device_count>   s   r   )N)Zpaddle.baser   Zpaddle.utilsr   __all__r   r   r   r   r   r   <module>   s   !