§
    Pzni  ã            	       óR   — 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d
ede	fd„Z
dS )é    )ÚAnyN)Ú_get_device_indexFÚ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| › �¦  «        ‚n| j        dk    rt          d| › �¦  «        ‚t          j                             ¦   «         s&t          | t          j	        j        ¦  «        r| j
        S t          | ||¦  «        S )a¶  Gets 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 CUDA device. Note that for a CUDA device without a specified index,
    i.e., ``torch.device('cuda')``, this will return the current default CUDA
    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 CUDA
    device if :attr:`optional` is ``True``.
    )ÚcudaÚcpuz(Expected a cuda or cpu device, but got: r
   z!Expected a cuda device, but got: )Ú
isinstanceÚintÚstrÚtorchr   ÚtypeÚ
ValueErrorÚjitÚis_scriptingr
   ÚidxÚ_torch_get_device_index)r   r   r   s      úq/var/www/html/cool-property-finder/image-detection-backend/venv/lib/python3.11/site-packages/torch/cuda/_utils.pyr   r   	   sî   € õ" �&�#ÑÔð ØˆÝ�&�#ÑÔð &Ý”˜fÑ%Ô%ˆÝ�&�%œ,Ñ'Ô'ð KØð 	KØŒ{ /Ð1Ð1Ý Ð!TÈFÐ!TÐ!TÑUÔUÐUð 2àŒ[˜FÒ"Ð"ÝÐIÀÐIÐIÑJÔJÐJÝŒ9×!Ò!Ñ#Ô#ð Ý�f�eœjÔ/Ñ0Ô0ð 	Ø”:ÐÝ" 6¨8°YÑ?Ô?Ð?ó    Únamec                 óp   — dt           fd„}t          | t          f |d¦  «         |d¦  «        dœ¦  «        S )NÚis_initc                 ó   ‡ — ˆ fd„}|S )Nc                 óT   •— ‰r| j         j        }n| j        }t          d|› �¦  «        ‚)Nz&Tried to instantiate dummy base class )Ú	__class__Ú__name__ÚRuntimeError)ÚobjÚargsÚkwargsÚ
class_namer   s       €r   Úerr_fnz/_dummy_type.<locals>.get_err_fn.<locals>.err_fn,   s5   ø€ Øð *Ø œ]Ô3�
�
à œ\�
ÝÐTÈ
ÐTÐTÑUÔUÐUr   © )r   r$   s   ` r   Ú
get_err_fnz_dummy_type.<locals>.get_err_fn+   s(   ø€ ð	Vð 	Vð 	Vð 	Vð 	Vð ˆr   TF)Ú__init__Ú__new__)Úboolr   Úobject)r   r&   s     r   Ú_dummy_typer+   *   sV   € ð�Dð ð ð ð õ Ø�vˆi j j°Ñ&6Ô&6À:À:ÈeÑCTÔCTÐUÐUñô ð r   )FF)Útypingr   r   Útorch._utilsr   r   r)   r   r   r   r+   r%   r   r   ú<module>r.      sª   ðØ Ð Ð Ð Ð Ð à €€€ð FÐ EÐ EÐ EÐ EÐ Eð <Að@ð @Øð@Øð@Ø48ð@àð@ð @ð @ð @ðB�cð ˜dð ð ð ð ð ð r   