
    9i                     0    d dl Z d dlmZ ddededefdZdS )	    N)DeviceFdeviceoptionalreturnc                    t          | t                    r| S t          | t                    rt          j        |           } d }t          | t          j                  r`t          j                                        }|t          d          |j        | j        k    rt          | j         d| d          | j
        }|2|st          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   acceleratorcurrent_acceleratorRuntimeErrortype
ValueErrorindexcurrent_device_index)r   r   device_indexaccs       K/var/www/icac/venv/lib/python3.11/site-packages/torch/accelerator/_utils.py_get_device_indexr      s   &# &# &f%%#L&%,'' $3355;56668v{"";MMsMMM   | 	aY_aa    55777    )F)r   torch.typesr   	_device_tboolr
   r    r   r   <module>r      sX     + + + + + + i 4 C      r   