U
    q±ËhC   ã                /   @  sˆ  d dl mZ d dlZd dlmZmZmZmZmZ d dl	Z
d dlmZmZmZ G dd„ deƒZeejƒee
 d¡eejƒdƒeejƒee
 d	¡eejƒd
ƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d¡eejƒdƒeejƒee
 d ¡eejƒd!ƒeej ƒee
 d"¡eej ƒd#ƒeej!ƒee
 d$¡eej!ƒd%ƒeej"ƒee
 d¡eejƒd&ƒeej#ƒee
 d¡eejƒd'ƒeej$ƒee
 d¡eejƒd(ƒeej%ƒee
 d¡eejƒd)ƒeej&ƒee
 d	¡eejƒd*ƒeej'ƒee
 d¡eejƒd+ƒiZ(G d,d-„ d-e)ƒZ*e*d.d/„ e( +¡ D ƒd0d1ƒZ,e*d2d/„ e( +¡ D ƒd3d4ƒZ-d5d/„ e, +¡ D ƒZ.e*eeeeee/ef f e.ƒd6d7ƒZ0eejƒd8eejƒd9eejƒd:eejƒd9eejƒd9eejƒd;eejƒd8eejƒd;eejƒd<eej ƒd<eej!ƒd=eejƒd9iZ1e*eeeeee/ef f e1ƒd>ƒZ2e*eej3ƒd?eej4ƒd@eej5ƒdAeej6ƒdBeej7ƒdCidDƒZ8e*eej3ƒdEeej4ƒdFeej5ƒdGeej6ƒdHeej7ƒdCidIƒZ9dS )Jé    )ÚannotationsN)ÚAnyÚDictÚ
NamedTupleÚUnionÚcast)ÚOptionalProtoÚSequenceProtoÚTensorProtoc                   @  s&   e Zd ZU ded< ded< ded< dS )ÚTensorDtypeMapznp.dtypeÚnp_dtypeÚintÚstorage_dtypeÚstrÚnameN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__© r   r   ú0/tmp/pip-unpacked-wheel-xnis5xre/onnx/mapping.pyr      s   
r   Zfloat32zTensorProto.FLOATZuint8zTensorProto.UINT8Zint8zTensorProto.INT8Zuint16zTensorProto.UINT16Zint16zTensorProto.INT16Zint32zTensorProto.INT32Zint64zTensorProto.INT64ÚboolzTensorProto.BOOLZfloat16zTensorProto.FLOAT16zTensorProto.BFLOAT16Zfloat64zTensorProto.DOUBLEZ	complex64zTensorProto.COMPLEX64Z
complex128zTensorProto.COMPLEX128Zuint32zTensorProto.UINT32Zuint64zTensorProto.UINT64ÚobjectzTensorProto.STRINGzTensorProto.FLOAT8E4M3FNzTensorProto.FLOAT8E4M3FNUZzTensorProto.FLOAT8E5M2zTensorProto.FLOAT8E5M2FNUZzTensorProto.UINT4zTensorProto.INT4c                      sN   e Zd Zddddddœ‡ fdd„Zdd	d
œdd„Zdddœ‡ fdd„Z‡  ZS )ÚDeprecatedWarningDictÚ zdict[int, int | str | np.dtype]r   ÚNone)Ú
dictionaryÚoriginal_functionÚfuture_functionÚreturnc                   s   t ƒ  |¡ || _|| _d S )N)ÚsuperÚ__init__Ú_origin_functionÚ_future_function)Úselfr   r   r   ©Ú	__class__r   r   r!   _   s    zDeprecatedWarningDict.__init__r   r   )Úotherr   c                 C  s&   t |tƒsdS | j|jko$| j|jkS )NF)Ú
isinstancer   r"   r#   )r$   r'   r   r   r   Ú__eq__i   s
    

þzDeprecatedWarningDict.__eq__zint | str | np.dtyper   )Úkeyr   c                   sX   | j s&tjtd| j› dƒtdd n&tjtd| j› d| j › dƒtdd tƒ  |¡S )Nz	`mapping.z˜` is now deprecated and will be removed in a future release.To silence this warning, please simply use if-else statement to get the corresponding value.é   )Ú
stacklevelzh` is now deprecated and will be removed in a future release.To silence this warning, please use `helper.z
` instead.)r#   ÚwarningsÚwarnr   r"   ÚDeprecationWarningr    Ú__getitem__)r$   r*   r%   r   r   r0   q   s     ÿú	ÿúz!DeprecatedWarningDict.__getitem__)r   )r   r   r   r!   r)   r0   Ú__classcell__r   r   r%   r   r   ^   s    ü
r   c                 C  s   i | ]\}}||j “qS r   )r   ©Ú.0Ztensor_dtypeÚvaluer   r   r   Ú
<dictcomp>‰   s      r5   ÚTENSOR_TYPE_TO_NP_TYPEZtensor_dtype_to_np_dtypec                 C  s   i | ]\}}||j “qS r   )r   r2   r   r   r   r5   ‘   s   ÿ Ú"TENSOR_TYPE_TO_STORAGE_TENSOR_TYPEZ$tensor_dtype_to_storage_tensor_dtypec              
   C  s:   i | ]2\}}|t jt jt jt jt jt jt jfkr||“qS r   )r
   ÚBFLOAT16ÚFLOAT8E4M3FNÚFLOAT8E4M3FNUZÚ
FLOAT8E5M2ÚFLOAT8E5M2FNUZÚUINT4ÚINT4)r3   ÚkÚvr   r   r   r5   ›   s   ùÿþ ÚNP_TYPE_TO_TENSOR_TYPEZnp_dtype_to_tensor_dtypeZ
float_dataZ
int32_dataZ
int64_dataZdouble_dataZuint64_dataZstring_dataÚSTORAGE_TENSOR_TYPE_TO_FIELDZtensor_valuesZsparse_tensor_valuesZsequence_valuesZ
map_valuesZoptional_valueÚSTORAGE_ELEMENT_TYPE_TO_FIELDZtensor_valueZsparse_tensor_valueZsequence_valueZ	map_valueÚOPTIONAL_ELEMENT_TYPE_TO_FIELD):Ú
__future__r   r-   Útypingr   r   r   r   r   ZnumpyÚnpZonnxr   r	   r
   r   r   ÚFLOATZdtypeZUINT8ZINT32ZINT8ZUINT16ZINT16ZINT64ZBOOLZFLOAT16r8   ZDOUBLEZ	COMPLEX64Z
COMPLEX128ZUINT32ZUINT64ÚSTRINGr9   r:   r;   r<   r=   r>   ZTENSOR_TYPE_MAPÚdictr   Úitemsr6   r7   Z_NP_TYPE_TO_TENSOR_TYPEr   rA   Z_STORAGE_TENSOR_TYPE_TO_FIELDrB   ZTENSORZSPARSE_TENSORZSEQUENCEZMAPÚOPTIONALrC   rD   r   r   r   r   Ú<module>   s°     ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ   ÿ½I*ýþúþý	            ôþ     ûø     ûø