
    Phb                     &   d Z ddlmZ ddlmZmZmZ ddlZddlm	Z
 ddlmZ g d	Zee
eedf   Zd
efdZd
efdZdded
dfdZ G d d      Z G d d      Z e       Zeadded
efdZ G d de      Zded
efdZd
efdZded
dfdZd
efdZy)zj
This package implements abstractions found in ``torch.cuda``
to facilitate writing device-agnostic code.
    )AbstractContextManager)AnyOptionalUnionN   device   )amp)
is_availablesynchronizecurrent_devicecurrent_streamstream
set_devicedevice_countStreamStreamContextEventreturnc                  R    t         j                  j                  j                         S )z/Returns a bool indicating if CPU supports VNNI.)torch_C_cpu_is_cpu_support_vnni     ]C:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/cpu/__init__.pyr   r      s    88==--//r   c                       y)zReturns a bool indicating if CPU is currently available.

    N.B. This function only exists to facilitate device-agnostic code

    Tr   r   r   r   r   r   #   s     r   r	   c                      y)zWaits for all kernels in all streams on the CPU device to complete.

    Args:
        device (torch.device or int, optional): ignored, there's only one CPU device.

    N.B. This function only exists to facilitate device-agnostic code.
    Nr   r   s    r   r   r   ,   s     	r   c                   &    e Zd ZdZddefdZddZy)r   zH
    N.B. This class only exists to facilitate device-agnostic code
    priorityc                      y Nr   )selfr"   s     r   __init__zStream.__init__<       r   Nc                      y r$   r   r%   r   s     r   wait_streamzStream.wait_stream?   r'   r   ))r   N)__name__
__module____qualname____doc__intr&   r*   r   r   r   r   r   7   s     r   r   c                   .    e Zd ZdefdZddZd ZddZy)r   r   c                      y)NTr   r%   s    r   queryzEvent.queryD   s    r   Nc                      y r$   r   r)   s     r   recordzEvent.recordG   r'   r   c                      y r$   r   r3   s    r   r   zEvent.synchronizeJ   r'   r   c                      y r$   r   r)   s     r   waitz
Event.waitM   r'   r   r$   )r,   r-   r.   boolr4   r6   r   r9   r   r   r   r   r   C   s    t r   r   c                     t         S )zReturns the currently selected :class:`Stream` for a given device.

    Args:
        device (torch.device or int, optional): Ignored.

    N.B. This function only exists to facilitate device-agnostic code

    )_current_streamr   s    r   r   r   U   s
     r   c                   B    e Zd ZU dZee   ed<   d Zd Zde	de	de	fdZ
y	)
r   zvContext-manager that selects a given stream.

    N.B. This class only exists to facilitate device-agnostic code

    
cur_streamc                 (    || _         t        | _        y r$   )r   _default_cpu_streamprev_streamr)   s     r   r&   zStreamContext.__init__i   s    .r   c                 <    | j                   }|y t        | _        |ay r$   )r   r<   rA   )r%   r>   s     r   	__enter__zStreamContext.__enter__m   s#    [[
 +$r   typevalue	tracebackc                 :    | j                   }|y | j                  ay r$   )r   rA   r<   )r%   rD   rE   rF   r>   s        r   __exit__zStreamContext.__exit__v   s!    [[
 **r   N)r,   r-   r.   r/   r   r   __annotations__r&   rC   r   rH   r   r   r   r   r   a   s8    
   /%+S + + +r   r   r   c                     t        |       S )zWrapper around the Context-manager StreamContext that
    selects a given stream.

    N.B. This function only exists to facilitate device-agnostic code
    )r   )r   s    r   r   r      s       r   c                       y)zReturns number of CPU devices (not cores). Always 1.

    N.B. This function only exists to facilitate device-agnostic code
    r
   r   r   r   r   r   r      s    
 r   c                      y)zzSets the current device, in CPU we do nothing.

    N.B. This function only exists to facilitate device-agnostic code
    Nr   r   s    r   r   r      s    
 	r   c                       y)zyReturns current device for cpu. Always 'cpu'.

    N.B. This function only exists to facilitate device-agnostic code
    cpur   r   r   r   r   r      s    
 r   r$   )r/   
contextlibr   typingr   r   r   r    r	   _devicer   __all__strr0   	_device_tr:   r   r   r   r   r   r@   r<   r   r   r   r   r   r   r   r   r   <module>rV      s   
 . ' '     '3T)*	0d 0
d 		 	T 		 	  h %	9 	 	+* +<!6 !4 !c 	y 	T 	 r   