Ë
    [^(h=  ã            	       ó@   — d dl mZ d dlZd dlmZ 	 d	dedededefd„Zy)
é    )ÚAnyN)Ú_get_device_indexÚdeviceÚoptionalÚ	allow_cpuÚreturnc                 óÐ  — t        | t        «      r| S t        | t        «      rt        j                  | «      } t        | t        j                  «      r;|r| j
                  dvr+t        d| › �«      ‚| j
                  dk7  rt        d| › �«      ‚t        j                  j                  «       s0t        | t        j                  j                  «      r| j                  S t        | ||«      S )a±  Get the device index from :attr:`device`, which can be a torch.device object, a Python integer, or ``None``.

    If :attr:`device` is a torch.device object, returns the device index if it
    is a MTIA device. Note that for a MTIA device without a specified index,
    i.e., ``torch.device('mtia')``, this will return the current default MTIA
    device if :attr:`optional` is ``True``. If :attr:`allow_cpu` is ``True``,
    CPU devices will be accepted and ``-1`` will be returned in this case.

    If :attr:`device` is a Python integer, it is returned as is.

    If :attr:`device` is ``None``, this will return the current default MTIA
    device if :attr:`optional` is ``True``.
    )ÚmtiaÚcpuz(Expected a mtia or cpu device, but got: r
   z!Expected a mtia device, but got: )Ú
isinstanceÚintÚstrÚtorchr   ÚtypeÚ
ValueErrorÚjitÚis_scriptingr
   ÚidxÚ_torch_get_device_index)r   r   r   s      úO/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/mtia/_utils.pyr   r   	   s·   € ô  �&œ#ÔØˆÜ�&œ#ÔÜ—‘˜fÓ%ˆÜ�&œ%Ÿ,™,Ô'ÙØ�{‰{ /Ñ1Ü Ð#KÈFÈ8Ð!TÓUÐUØ�[‰[˜FÒ"ÜÐ@ÀÀÐIÓJÐJÜ�9‰9×!Ñ!Ô#Ü�fœeŸj™j×/Ñ/Ô0Ø—:‘:ÐÜ" 6¨8°YÓ?Ð?ó    )FF)Útypingr   r   Útorch._utilsr   r   Úboolr   © r   r   ú<module>r      sA   ðÝ ã õ Fð <Añ@Øð@Øð@Ø48ð@àô@r   