U
    Ç9%ey
  ã                   @   sb   d dl Z d dlmZ d dlmZ d dlZdae d¡dd„ ƒZG dd„ deƒZ	d	d
„ Z
dd„ ZdS )é    N)ÚTorchFunctionMode©Úcontext_decoratoré   c                (   C   sª   t jt jt jt jt jt jt jt jt j	t j
jt j
jt jt jt jt jt jt jt jt jjt jt jt jt jt jt jt jt jt jt jt jt j t j!t j"t j#t j$t j%t j&t j't j(t j%h(S ©N))ÚtorchÚemptyZempty_permutedZempty_stridedZempty_quantizedZonesZarangeZbartlett_windowZblackman_windowÚeyeZfftZfftfreqZrfftfreqÚfullÚfillZhamming_windowZhann_windowZkaiser_windowZlinspaceZlogspaceÚnestedZnested_tensorZrandZrandnÚrandintZrandpermÚrangeZsparse_coo_tensorZsparse_compressed_tensorZsparse_csr_tensorZsparse_csc_tensorZsparse_bsr_tensorZsparse_bsc_tensorZtril_indicesZtriu_indicesZvanderZzerosZasarrayZtensorZ	as_tensorZscalar_tensor© r   r   úR/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/torch/utils/_device.pyÚ_device_constructors   sR    Ôr   c                       s:   e Zd Zdd„ Z‡ fdd„Z‡ fdd„Zdd	d
„Z‡  ZS )ÚDeviceContextc                 C   s   t  |¡| _d S r   )r   Údevice)Úselfr   r   r   r   Ú__init__;   s    zDeviceContext.__init__c                    s   t | _| ja tƒ  ¡ S r   )ÚCURRENT_DEVICEÚ
old_devicer   ÚsuperÚ	__enter__)r   ©Ú	__class__r   r   r   >   s    zDeviceContext.__enter__c                    s   | j atƒ  |||¡S r   )r   r   r   Ú__exit__)r   Úexc_typeÚexc_valÚexc_tbr   r   r   r   D   s    zDeviceContext.__exit__r   Nc                 C   s4   |pi }|t ƒ kr*| d¡d kr*| j|d< |||ŽS )Nr   )r   Úgetr   )r   ÚfuncÚtypesÚargsÚkwargsr   r   r   Ú__torch_function__I   s    
z DeviceContext.__torch_function__)r   N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r%   Ú__classcell__r   r   r   r   r   :   s   r   c                    s   t ‡ fdd„|ƒS )Nc                      s   ˆ S r   r   r   ©r   r   r   Ú<lambda>Q   ó    z"device_decorator.<locals>.<lambda>r   )r   r!   r   r*   r   Údevice_decoratorP   s    r-   c                    s   ‡ fdd„S )zá
    Decorator which sets the default device inside of the wrapped
    function.  If you would like to use this as a context manager,
    use device as a context manager directly, e.g.,
    ``with torch.device(device)``.
    c                    s   t t ˆ ¡| ƒS r   )r-   r   r   )r!   r*   r   r   r+   Z   r,   zset_device.<locals>.<lambda>r   r*   r   r*   r   Ú
set_deviceS   s    r.   )r   Ztorch.overridesr   Ztorch.utils._contextlibr   Ú	functoolsr   Ú	lru_cacher   r   r-   r.   r   r   r   r   Ú<module>   s   
1