U
    yh                     @   sN  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mZmZ ddlmZmZ ddddd	d
dddddg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e jdZee je je jdZee je je jdZedddZedddZ dd Z!dd 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_ln_configs_get_rnn_op_configs_get_share_qparams_op_configs_get_tensor_info_op_configs)BackendConfigDTypeConfig*get_test_only_legacy_native_backend_configdefault_op_quint8_dtype_configdefault_op_fp16_dtype_config!default_dynamic_int8_dtype_config$default_dynamic_float16_dtype_config%input_output_only_quint8_dtype_configweight_only_quint8_dtype_config!weight_only_quint4x2_dtype_configget_native_backend_configget_native_backend_config_dict/get_test_only_legacy_native_backend_config_dict)input_dtypeoutput_dtypeweight_dtype
bias_dtype)r   r   T)r   r   r   r   Z
is_dynamic)r   r   r   )returnc            
      C   s   t g} t tttg}ttg}tg}ttg}ttg}tg}ttg}ttg}tg}	td	t
| 	t|	t|t|	t|	t|	t|	t|	t|	t|		t|	t|S )zr
    Return the `BackendConfig` for PyTorch Native backend (fbgemm/qnnpack) with various additional fp16 ops.
    Z_native_and_fp16)weighted_op_quint8_dtype_configr   r   r   r   r   r   r   r   set_backend_pattern_configsr   r
   r   set_backend_pattern_configr   r   r	   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tensor_info_op_dtype_configsZrnn_op_dtype_configsZembedding_op_dtype_configsZlayer_norm_op_dtype_configs r%   ]/var/www/html/venv/lib/python3.8/site-packages/torch/ao/quantization/backend_config/native.pyr   i   sd    	
c            
      C   s   t g} t ttg}tg}tg}tg}tg}tg}ttg}ttg}tg}	tdt	| t
|t|t|t|t|t|t|t|t|	t|t|S )zQ
    Return the `BackendConfig` for PyTorch Native backend (fbgemm/qnnpack).
    native)r!   r   r   r   r   r   r   r   r"   r   r
   r   r#   r   r   r	   r   r   r   r   r   r   r$   r%   r%   r&   r      sT    	
c                   C   s
   t   S )zd
    Return the `BackendConfig` for PyTorch Native backend (fbgemm/qnnpack) in dictionary form.
    )r   to_dictr%   r%   r%   r&   r      s    c                   C   s
   t   S )z
    Return the `BackendConfig` for PyTorch Native backend (fbgemm/qnnpack) with various additional
    fp16 ops in dictionary form.
    )r   r(   r%   r%   r%   r&   r      s    )#ZtorchZ_common_operator_config_utilsr   r   r   r   r   r   r	   r
   r   r   r   r   Zbackend_configr   r   __all__Zquint8Zqint8floatr!   r   Zfloat16r   r   r   r   r   Zquint4x2r   r   r   r   r   r%   r%   r%   r&   <module>   s   82'