a
    8Sic                     @   s  d Z ddlmZ ddlZg dZg edZdd ZG dd	 d	eZed
Z	dd Z
eejejfZdd Zeejf Zdd Zdd Zeejejf Zdd Zdd ZeejejfZdd ZeejejejejejfZ dd Z!dd Z"ee  Z#dd Z$dd  Z%eejejfZ&d!d" Z'd#d$ Z(e#e& Z)d%d& Z*d'd( Z+e#ejf Z,d)d* Z-d;eej. d-d.d/Z/eej. d-d0d1Z0d<eej. d-d2d3Z1eej. d-d4d5Z2d=eej. d-d6d7Z3eej. d-d8d9Z4ee5 d-d:dZ6dS )>a  This module exist to be able to deprecate functions publicly without doing so internally. The deprecated
public versions are defined in torch.testing._deprecated and exposed from torch.testing. The non-deprecated internal
versions should be imported from torch.testing._internal
    )ListN)_validate_dtypes_dispatch_dtypes	all_typesall_types_andall_types_and_complexall_types_and_complex_andall_types_and_halfcomplex_typesempty_typesfloating_and_complex_typesfloating_and_complex_types_andfloating_typesfloating_types_anddouble_typesfloating_types_and_halfget_all_complex_dtypesget_all_dtypesget_all_fp_dtypesget_all_int_dtypesget_all_math_dtypesintegral_typesintegral_types_andget_all_device_typesc                  G   s   | D ]}t |tjsJ q| S N)
isinstancetorchdtype)dtypesr    r   Q/var/www/html/django/DPS/env/lib/python3.9/site-packages/torch/testing/_legacy.pyr   ,   s    r   c                   @   s   e Zd Zdd ZdS )r   c                 C   s   t |tsJ tt| |S r   )r   tupler   __add__)selfotherr   r   r    r"   3   s    z_dispatch_dtypes.__add__N)__name__
__module____qualname__r"   r   r   r   r    r   2   s   r   r   c                   C   s   t S r   )_empty_typesr   r   r   r    r   8   s    r   c                   C   s   t S r   )_floating_typesr   r   r   r    r   <   s    r   c                   C   s   t S r   )_floating_types_and_halfr   r   r   r    r   @   s    r   c                  G   s   t t|   S r   )r)   r   r   r   r   r    r   C   s    r   c                   C   s   t S r   )_floating_and_complex_typesr   r   r   r    r   G   s    r   c                  G   s   t t|   S r   )r,   r   r+   r   r   r    r   J   s    r   c                   C   s   t S r   )_double_typesr   r   r   r    r   N   s    r   c                   C   s   t S r   )_integral_typesr   r   r   r    r   R   s    r   c                  G   s   t t|   S r   )r.   r   r+   r   r   r    r   U   s    r   c                   C   s   t S r   )
_all_typesr   r   r   r    r   Y   s    r   c                  G   s   t t|   S r   )r/   r   r+   r   r   r    r   \   s    r   c                   C   s   t S r   )_complex_typesr   r   r   r    r
   `   s    r
   c                  G   s   t t|   S r   )r0   r   r+   r   r   r    complex_types_andc   s    r1   c                   C   s   t S r   )_all_types_and_complexr   r   r   r    r   g   s    r   c                  G   s   t t|   S r   )r2   r   r+   r   r   r    r   j   s    r   c                   C   s   t S r   )_all_types_and_halfr   r   r   r    r	   n   s    r	   TF)returnc                 C   sD   t  t| |d }|r"|tj |r2|t|7 }|r@|t 7 }|S )Ninclude_halfinclude_bfloat16)r   r   appendr   boolr   get_all_qint_dtypes)r6   r7   Zinclude_boolZinclude_complexinclude_complex32Zinclude_qintr   r   r   r    r   t   s    
r   c                 C   s   t  t| ddd t  S )NcudaFr5   )r   r   
startswithr   )devicer   r   r    r      s
    r   c                 C   s    | rt jt jt jgS t jt jgS r   )r   	complex32	complex64
complex128)r;   r   r   r    r      s    r   c                   C   s   t jt jt jt jt jgS r   )r   uint8int8int16int32int64r   r   r   r    r      s    r   c                 C   s0   t jt jg}| r|t j |r,|t j |S r   )r   float32float64r8   float16bfloat16)r6   r7   r   r   r   r    r      s    r   c                   C   s   t jt jt jt jt jgS r   )r   qint8quint8qint32quint4x2quint2x4r   r   r   r    r:      s    r:   c                   C   s   t j sdgS ddgS )Ncpur<   )r   r<   is_availabler   r   r   r    r      s    )TTTTFF)F)TT)7__doc__typingr   r   __all_dtype_getters____all__r   r!   r   r(   r   rG   rH   r)   r   halfr*   r   r   cfloatcdoubler,   r   r   rA   r-   r   rB   rC   rD   rE   rF   r.   r   r   r/   r   r   r0   r
   r1   r2   r   r   r3   r	   r   r   r   r   r   r   r:   strr   r   r   r   r    <module>   sf   	      	