
    sg                     z   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 dgZ ee j"                  e j"                  e j$                  e j&                        Z ee j"                  e j"                        Z ee j,                  e j,                  e j,                  e j,                        Z ee j"                  e j&                  e j$                  e j&                  d	      Z ee j,                  e j&                  e j,                  e j&                  d	      Z ee j&                  e j&                  e j"                  
      Z ee j&                  e j&                  e j6                  
      Z ee j$                  d      Z ee j$                  ddd      Z eeeee j&                        Z eee      Z defdZ!y)    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get_qnnpack_backend_config)input_dtypeoutput_dtypeweight_dtype
bias_dtype)r   r   T)r   r   r   r   
is_dynamic)r   r   r   g      0?)dtypescale_min_lower_boundi   )r   quant_min_lower_boundquant_max_upper_boundr   returnc                     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      j                  t        |             j                  t        |            j                  t        |            j                  t        |            j                  t        |            j                  t!        |            j                  t#        |            j                  t%        |            j                  t'        |            j                  t)        |            S )zJ
    Return the `BackendConfig` for PyTorch's native QNNPACK backend.
    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   set_backend_pattern_configsr   r   r   set_backend_pattern_configr   r   r
   r   r   r   r	   )conv_dtype_configslinear_dtype_configsbinary_op_dtype_configsdefault_op_dtype_configsfixed_qparams_op_dtype_configsshare_qparams_op_dtype_configsrnn_op_dtype_configsembedding_op_dtype_configss           _/var/www/html/venv/lib/python3.12/site-packages/torch/ao/quantization/backend_config/qnnpack.pyr   r   s   sS   
 	9/
 	9/14	 	8.
 	8. 
 	8.&"
 	8.&"
 	24
 	01"
 	i 	$	$%67I%J	K	$	$%89M%N	O	$	$%;<S%T	U	#	#O4L$M	N	$	$%<=U%V	W	$	$)*HI

 
%	$)*HI

 
%	$_5M%N	O	$	$%89M%N	O	$	$%&@A

    )"torch_common_operator_config_utilsr   r   r   r   r   r	   r
   r   r   r   backend_configr   r   r   __all__quint8qint8floatr    r$   float16$qnnpack_default_op_fp16_dtype_configr!   r"   r%   quint4x2r&   $qnnpack_act_qint8_scale_min_2_neg_126qnnpack_weight_qint8_neg_127_to_127_scale_min_2_neg_12r   r#   r    r2   r1   <module>r@      s      M L ! +6{{	+ ' *5* &
 (3}}	( $ -8{{- ) 0;{{0 , +6+ ' -8- )$ (<
++ ( $
 :N
++ 	: 6 4?45G{{	4 0 3>453 /8M 8r2   