o
    "i                      @   s6  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dZd
efddZd
efddZd
efddZd&ded
dfddZG dd dZG dd dZe Zead&ded
efddZG dd deZded
efddZd
efd d!Zded
dfd"d#Zd
efd$d%ZdS )'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                   C      t jj S )z/Returns a bool indicating if CPU supports AVX2.)torch_C_cpu_is_cpu_support_avx2 r   r   P/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/torch/cpu/__init__.pyr          r   c                   C   r   )z1Returns a bool indicating if CPU supports AVX512.)r   r   r   _is_cpu_support_avx512r   r   r   r   r   %   r   r   c                   C   r   )z/Returns a bool indicating if CPU supports VNNI.)r   r   r   _is_cpu_support_vnnir   r   r   r   r   *   r   r   c                   C      dS )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                 C   r    )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   r   r   r   r   8       r   c                   @   s.   e Zd ZdZd
deddfddZddd	ZdS )r   zH
    N.B. This class only exists to facilitate device-agnostic code
    priorityr   Nc                 C      d S Nr   )selfr#   r   r   r   __init__G      zStream.__init__c                 C   r$   r%   r   r&   r   r   r   r   wait_streamJ   r(   zStream.wait_stream)r"   r   N)__name__
__module____qualname____doc__intr'   r*   r   r   r   r   r   B   s    r   c                   @   s<   e Zd ZdefddZddddZdddZddd	d
ZdS )r   r   c                 C   r    )NTr   r&   r   r   r   queryO   r(   zEvent.queryNc                 C   r$   r%   r   r)   r   r   r   recordR   r(   zEvent.recordc                 C   r$   r%   r   r1   r   r   r   r   U   r(   zEvent.synchronizec                 C   r$   r%   r   r)   r   r   r   waitX   r(   z
Event.waitr%   r+   )r,   r-   r.   boolr2   r3   r   r4   r   r   r   r   r   N   s
    
r   c                 C   s   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   r   r   r   r   `   s   	r   c                   @   sH   e Zd ZU dZee ed< dd Zdd Zde	de	d	e	d
dfddZ
dS )r   zvContext-manager that selects a given stream.

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

    
cur_streamc                 C   s   || _ t| _d S r%   )r   _default_cpu_streamprev_streamr)   r   r   r   r'   u   s   
zStreamContext.__init__c                 C   s    | j }|d u r	d S t| _|ad S r%   )r   r6   r9   )r&   r7   r   r   r   	__enter__y   s
   zStreamContext.__enter__typevalue	tracebackr   Nc                 C   s   | j }|d u r	d S | jad S r%   )r   r9   r6   )r&   r;   r<   r=   r7   r   r   r   __exit__   s   
zStreamContext.__exit__)r,   r-   r.   r/   r   r   __annotations__r'   r:   r   r>   r   r   r   r   r   l   s   
 	r   r   c                 C   s   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   r   r   r   r      s   c                   C   r    )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         r   c                 C   r    )zzSets the current device, in CPU we do nothing.

    N.B. This function only exists to facilitate device-agnostic code
    Nr   r   r   r   r   r      r!   r   c                   C   r    )zyReturns current device for cpu. Always 'cpu'.

    N.B. This function only exists to facilitate device-agnostic code
    cpur   r   r   r   r   r      r@   r   r%   ) r/   
contextlibr   typingr   r   r   r    r   _devicer
   __all__strr0   	_device_tr5   r   r   r   r   r   r   r   r8   r6   r   r   r   r   r   r   r   r   r   r   <module>   s.   	
	