U
    9%e
                     @   s   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 d	d
dddddgZee
eedf ZedddZeddd	Zdedddd
ZG dd dZe ZeadeedddZG dd deZeedddZed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_streamstreamdevice_countStreamStreamContext)returnc                   C   s   t jj S )z/Returns a bool indicating if CPU supports VNNI.)torchZ_CZ_cpu_is_cpu_support_vnni r   r   Q/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/torch/cpu/__init__.pyr      s    r   c                   C   s   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   s   dS )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   (   s    c                   @   s   e Zd ZdZdS )r   zH
    N.B. This class only exists to facilitate device-agnostic code
    N)__name__
__module____qualname____doc__r   r   r   r   r   3   s   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    	c                   @   s@   e Zd ZU dZee ed< dd Zdd Ze	e	e	d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 N)r   _default_cpu_streamprev_stream)selfr   r   r   r   __init__S   s    zStreamContext.__init__c                 C   s    | j }|d krd S t| _|ad S r   )r   r   r   )r    r   r   r   r   	__enter__W   s
    zStreamContext.__enter__)typevalue	tracebackc                 C   s   | j }|d krd S | jad S r   )r   r   r   )r    r#   r$   r%   r   r   r   r   __exit__`   s    zStreamContext.__exit__N)r   r   r   r   r   r   __annotations__r!   r"   r   r&   r   r   r   r   r   K   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   i   s    c                   C   s   dS )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   s    )N)N)r   
contextlibr   typingr   r   r   r    r   Z_devicer
   __all__strintZ	_device_tboolr   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>   s0   
		