o
    Zh                     @   s<   d dl mZ d dlZd dlmZ d
dededefdd	ZdS )    )OptionalN)DeviceFdeviceoptionalreturnc                 C   s   t | tr| S t | trt| } d }t | tjr=tj }|d u r&td|j| jkr:t	| j dtj  d| j
}|d u rO|sJt	d|  tj S |S )NzAccelerator expectedz' doesn't match the current accelerator .zFExpected a torch.device with a specified index or an integer, but got:)
isinstanceintstrtorchr   ZacceleratorZcurrent_acceleratorRuntimeErrortype
ValueErrorindexZcurrent_device_index)r   r   Zdevice_indexacc r   G/var/www/auris/lib/python3.10/site-packages/torch/accelerator/_utils.py_get_device_index   s*   




r   )F)	typingr   r   Ztorch.typesr   Z	_device_tboolr	   r   r   r   r   r   <module>   s    