
    ȅi                     2    S SK r S SKJr  SS\S\S\4S jjrg)    N)Devicedeviceoptionalreturnc                    [        U [        5      (       a  U $ [        U [        5      (       a  [        R                  " U 5      n S n[        U [        R                  5      (       am  [        R
                  R                  5       nUc  [        S5      eUR                  U R                  :w  a  [        U R                   SU S35      eU R                  nUc3  U(       d  [        SU  35      e[        R
                  R                  5       $ U$ )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       R/home/james-whalen/.local/lib/python3.13/site-packages/torch/accelerator/_utils.py_get_device_indexr      s    &#&#f%#L&%,,''335;56688v{{";;-Fse1M  ||XY_X`a    5577    )F)r   torch.typesr   	_device_tboolr
   r    r   r   <module>r      s%     +i 4 C r   