U
    Kc                     @   s>  d dl Z ddlmZmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZmZmZ ee je je je jdZee je jdZee je je je jdZee je je je jddZee je je je jddZee je je jd	Zee je je jd	Zee jd
dZee jddd
dZeeeee jdZeeedZedddZ dgZ!dS )    N   )
_get_binary_op_configs_get_bn_configs_get_cat_config_get_conv_configs_get_default_op_configs_get_embedding_op_configs_get_fixed_qparams_op_configs_get_linear_configs_get_rnn_op_configs_get_share_qparams_op_configs)BackendConfigDTypeConfigDTypeWithConstraints)input_dtypeoutput_dtypeweight_dtype
bias_dtype)r   r   T)r   r   r   r   Z
is_dynamic)r   r   r   g      0?)dtypescale_min_lower_boundi   )r   Zquant_min_lower_boundZquant_max_upper_boundr   )returnc                  C   s   t tg} t tttg}t tg}ttg}t tg}ttg}ttg}ttg}td	t
| 	t|	t|t|	t|	t|	t|	t|	t|	t|S )zJ
    Return the `BackendConfig` for PyTorch's native QNNPACK backend.
    Zqnnpack)0qnnpack_weighted_op_qint8_symmetric_dtype_config'qnnpack_weighted_op_quint8_dtype_config)qnnpack_default_dynamic_int8_dtype_config,qnnpack_default_dynamic_float16_dtype_config/qnnpack_default_op_qint8_symmetric_dtype_config&qnnpack_default_op_quint8_dtype_config'qnnpack_weight_only_quint8_dtype_config)qnnpack_weight_only_quint4x2_dtype_configr   Zset_backend_pattern_configsr   r
   r   Zset_backend_pattern_configr   r   r	   r   r   r   r   )Zconv_dtype_configsZlinear_dtype_configsZbinary_op_dtype_configsZdefault_op_dtype_configsZfixed_qparams_op_dtype_configsZshare_qparams_op_dtype_configsZrnn_op_dtype_configsZembedding_op_dtype_configs r    P/tmp/pip-unpacked-wheel-gikjz4vx/torch/ao/quantization/backend_config/qnnpack.pyget_qnnpack_backend_configm   s^    	
r"   )"ZtorchZ_common_operator_config_utilsr   r   r   r   r   r   r	   r
   r   r   Zbackend_configr   r   r   Zquint8Zqint8floatr   r   Zfloat16Z$qnnpack_default_op_fp16_dtype_configr   r   r   Zquint4x2r   Z$qnnpack_act_qint8_scale_min_2_neg_12Z6qnnpack_weight_qint8_neg_127_to_127_scale_min_2_neg_12r   r   r"   __all__r    r    r    r!   <module>   s   0
3