o
    ߗi                     @   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r3tj j| jkr0t| j dtj  d| j	}|d u rE|s@td|  tj
 S |S )Nz' doesn't match the current accelerator .zFExpected a torch.device with a specified index or an integer, but got:)
isinstanceintstrtorchr   acceleratorcurrent_acceleratortype
ValueErrorindexcurrent_device_index)r   r   device_index r   V/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/torch/accelerator/_utils.py_get_device_index   s$   



r   )F)	typingr   r   torch.typesr   	_device_tboolr	   r   r   r   r   r   <module>   s    