
    ёi}s                         S SK r S SKrS SKJr  S SKJr  S SKJr  SSKJ	r	J
r
  SSKJrJrJrJr  SS	KJrJr  S
rSrS r " S S5      r " S S5      r " S S5      rg)    N)IrGraph)core)quant_layers   )QuantWeightPassReplaceFakeQuantDequantPass)_get_input_name_index_get_op_input_var_names_get_output_name_index$move_persistable_var_to_global_block   )
fuse_utilsutils.pdmodelz
.pdiparamsc                 \   SSK Jn  UR                  R                  R                  R
                  U S'   UR                  R                  R                  R                  U S'   UR                  UR                  R                  5        UR                  UR                  R
                  5        X4$ )Nr   )fleetColumnParallelLinearRowParallelLinear)paddle.distributedr   meta_parallelparallel_layers	mp_layersr   r   append)layer_name_mapfake_quant_input_layersr   s      b/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/quantization/imperative/qat.pylazy_import_fleetr   &   s    ( 	++55JJ )* 	++55GG &' ""5#6#6#H#HI""5#6#6#K#KL22    c                   \   ^  \ rS rSrSr/ SQSSSSSSS	S	S	S	S4U 4S
 jjrS rSS jrSrU =r	$ )ImperativeQuantAware4   zB
Applying quantization aware training (QAT) to the dygraph model.
)Conv2DLinearConv2DTransposer   r   abs_maxmoving_average_abs_max   ?FNc                    > [         TU ]  5         Xpl        UUUUUUUU	U
US.
n[        S0 UD6U l        [        XeU5      U l        g)a  
The constructor for ImperativeQuantAware.

Args:
    quantizable_layer_type(list[str | layer]): List the type of
        layers that will be quantized. Default is ['Conv2D', 'Linear'].
    weight_quantize_type(str): quantization type for weights,
        which supports 'abs_max' and 'channel_wise_abs_max'.
    activation_quantize_type(str): quantization type for activations,
        which supports 'abs_max' and 'moving_average_abs_max' now.
        If using 'abs_max' mode, the quantization scale will be
        calculated dynamically each step in both training and testing
        period. If using 'moving_average_abs_max', the static
        quantization scale will be calculated during training and
        used in inference.
    weight_bits(int): quantization bit number for weights, whereas
        the bias is not quantized.
    activation_bits(int): quantization bit number for activations.
    moving_rate(float): the parameter for 'moving_average_abs_max'
        quantization.
    fuse_conv_bn(bool): Whether to fuse conv and bn, default is False.
    weight_preprocess_layer(paddle.nn.Layer, optional): A paddle
        Layer that defines how to preprocess weight before quantization.
        Using this can quickly test if user's preprocess method works
        or not. The input is non-quantized weight and function returns
        processed weight to be quantized.
        If None, the weight will be quantized directly.
        Default is None.
    act_preprocess_layer(paddle.nn.Layer, optional): A paddle Layer
        that defines how to preprocess activation before quantization.
        Using this can quickly test if user's preprocess method works
        or not. The input is non-quantized activation and function returns
        processed activation to be quantized.
        If None, the activation will be quantized directly.
        Default is None.
    weight_quantize_layer(paddle.nn.Layer, optional): A paddle Layer that
        defines how to quantize weight.
        Using this can quickly test if user's quantization method works or not.
        In this layer, user should both define quantization method and
        dequantization method, that is, the function's input is non-quantized
        weight and returns dequantized weight.
        If None, will use quantization op defined by 'weight_quantize_type'.
        Default is None.
    act_quantize_layer(paddle.nn.Layer, optional): A paddle Layer that defines
        how to quantize activation.
        Using this can quickly test if user's quantization method works or not.
        In this layer, user should both define quantization method and
        dequantization method, that is, the function's input is non-quantized
        activation and returns dequantized activation.
        If None, will use quantization op defined by 'activation_quantize_type'.
        Default is None.
    onnx_format (bool, optional): Whether to export the quantized model
        with format of ONNX. Default is False.

Note:
    If user sets attribute 'skip_quant' to a Layer that support dynamic
    quantization and sets it to true, the layer would not be quantized
    during training. If this attribute is not sets or the attribute is
    false, the Layer would be quantized in training.

Examples:
    .. code-block:: python

        >>> import paddle
        >>> from paddle.static.quantization import (
        ...     ImperativeQuantAware,
        ... )
        >>> from paddle.vision.models import (
        ...     resnet,
        ... )

        >>> model = resnet.resnet50(pretrained=True)

        >>> imperative_qat = ImperativeQuantAware(
        ...     weight_quantize_type='abs_max',
        ...     activation_quantize_type='moving_average_abs_max')

        >>> # Add the fake quant logical.
        >>> # The original model will be rewrite.
        >>> # The outscale of outputs in supported layers would be calculated.
        >>> imperative_qat.quantize(model)

        >>> # Fine-tune the quantized model
        >>> # ...

        >>> # Save quant model for the inference.
        >>> imperative_qat.save_quantized_model(
        ...     layer=model,
        ...     model_path="./resnet50_qat",
        ...     input_spec=[
        ...         paddle.static.InputSpec(
        ...         shape=[None, 3, 224, 224], dtype='float32')])

    .. code-block:: python

        >>> import paddle
        >>> from paddle.static.quantization import (
        ...     ImperativeQuantAware,
        ... )

        >>> class ImperativeModel(paddle.nn.Layer):
        ...     def __init__(self):
        ...         super().__init__()
        ...         # self.linear_0 would skip the quantization.
        ...         self.linear_0 = paddle.nn.Linear(784, 400)
        ...         self.linear_0.skip_quant = True

        ...         # self.linear_1 would not skip the quantization.
        ...         self.linear_1 = paddle.nn.Linear(400, 10)
        ...         self.linear_1.skip_quant = False

        ...     def forward(self, inputs):
        ...         x = self.linear_0(inputs)
        ...         x = self.linear_1(inputs)
        ...         return x

        >>> model = ImperativeModel()
        >>> imperative_qat = ImperativeQuantAware(
        ...     weight_quantize_type='abs_max',
        ...     activation_quantize_type='moving_average_abs_max')

        >>> # Add the fake quant logical.
        >>> # The original model will be rewrite.
        >>> #
        >>> # There is only one Layer(self.linear1) would be added the
        >>> # fake quant logical.
        >>> imperative_qat.quantize(model)

        >>> # Fine-tune the quantized model
        >>> # ...

        >>> # Save quant model for the inference.
        >>> imperative_qat.save_quantized_model(
        ...    layer=model,
        ...    model_path="./imperative_model_qat")
)
quantizable_layer_typeweight_quantize_typeactivation_quantize_typeweight_bitsactivation_bitsmoving_rateweight_preprocess_layeract_preprocess_layerweight_quantize_layeract_quantize_layerN )super__init__fuse_conv_bnImperativeQuantizeInputs_quantize_inputsImperativeQuantizeOutputs_quantize_outputs)selfr*   r+   r,   r-   r.   r/   r7   r0   r1   r2   r3   onnx_formatkwargs	__class__s                 r   r6   ImperativeQuantAware.__init__9   sb    z 	( '=$8(@&.&'>$8%:"4
 !9 B6 B!:+"
r   c                     [        U[        R                  R                  5      (       d   S5       eU R                  (       a  [
        R                  " U5        U R                  R                  U5        U R                  R                  U5        U$ )al  
According to weights' and activations' quantization types,
the model will be added some fake quant ops, such as
fake_quantize_dequantize_moving_average_abs_max,
fake_quantize_dequantize_abs_max and so on. At the same time,
the out_scale value of outputs would be calculated.

Args:
    model(paddle.nn.Layer): the model to be quantized.
Returns:
    None

Examples:
    .. code-block:: python

        >>> import paddle
        >>> from paddle.static.quantization import (
        ...     ImperativeQuantAware,
        ... )

        >>> class ImperativeModel(paddle.nn.Layer):
        ...     def __init__(self):
        ...         super().__init__()
        ...         # self.linear_0 would skip the quantization.
        ...         self.linear_0 = paddle.nn.Linear(784, 400)
        ...         self.linear_0.skip_quant = True

        ...         # self.linear_1 would not skip the quantization.
        ...         self.linear_1 = paddle.nn.Linear(400, 10)
        ...         self.linear_1.skip_quant = False

        ...     def forward(self, inputs):
        ...         x = self.linear_0(inputs)
        ...         x = self.linear_1(inputs)
        ...         return x

        >>> model = ImperativeModel()
        >>> imperative_qat = ImperativeQuantAware(
        ...     weight_quantize_type='abs_max',
        ...     activation_quantize_type='moving_average_abs_max')

        >>> # Add the fake quant logical.
        >>> # The original model will be rewrite.
        >>> #
        >>> # There is only one Layer(self.linear1) would be added the
        >>> # fake quant logical.
        >>> imperative_qat.quantize(model)
2The model must be the instance of paddle.nn.Layer.)	
isinstancepaddlennLayerr7   r   r9   applyr;   )r<   models     r   quantizeImperativeQuantAware.quantize   sp    b %11 	
@	
1 ##E*##E*$$U+r   c                     [         R                  R                  5          U R                  R                  " XU40 UD6  S S S 5        g ! , (       d  f       g = fN)rD   	pir_utils
OldIrGuardr;   save_quantized_model)r<   layerpath
input_specconfigs        r   rO   )ImperativeQuantAware.save_quantized_model(  sA    ((*""77Z+1 +**s   A
A)r9   r;   r7   rL   )
__name__
__module____qualname____firstlineno____doc__r6   rI   rO   __static_attributes____classcell__r?   s   @r   r    r    4   sG     
 '!9 $!"'q
f:x r   r    c            
       T   ^  \ rS rSrSr/ SQSSSSSSSSS4
U 4S	 jjrS
 rS rSrU =r	$ )r8   i/  zt
Based on the input params, add the quant_dequant computational
logic both for activation inputs and weight inputs.
)r"   r#   r$   r%   r&   r'   r(   Nc           
        >^  [         TT ]  5         [        [        R                  [        R
                  5      u  T l        T l        [        U 4S jU 5       5      T l        T R                   H2  n[        U[        5      (       d  UT R
                  ;   a  M*   U S35       e   1 SknSS1nUS:w  a  X,;   d   SU S35       eX=;   d   SU S	35       eS
 nU" U5      (       d   S5       eU" U5      (       d   S5       eS nU" U5      (       d   S5       eU" U5      (       d   S5       eU" U	5      (       d   S5       eU" U
5      (       d   S5       eUUUUUUUU	U
S.	T l
        g)zb
The constructor for ImperativeQuantizeInputs.

Please refer to the args of ImperativeQuantAware.
c              3   f   >#    U  H&  nUTR                   ;   a  TR                   U   OUv   M(     g 7frL   )r   ).0rP   r<   s     r   	<genexpr>4ImperativeQuantizeInputs.__init__.<locals>.<genexpr>L  s?      -
 0 D/// ##E* 0s   .1  is unsupported to be quantized.>   r%   
lsq_weightchannel_wise_abs_maxr&   channel_wise_lsq_weightr&   lsq_actz"Unsupported weight_quantize_type: z1. It can only be abs_max or channel_wise_abs_max.z&Unsupported activation_quantize_type: z7. It can only be moving_average_abs_max or lsq_act now.c                 R    [        U [        5      =(       a    U S:  =(       a    U S:*  $ )Nr      )rC   int)bitss    r   <lambda>3ImperativeQuantizeInputs.__init__.<locals>.<lambda>p  s     D#.K419KKr   z%weight_bits should be 1, 2,... or 16.z)activation_bits should be 1, 2,... or 16.c                 `    U S L =(       d$    [        U [        R                  R                  5      $ rL   )
issubclassrD   rE   rF   )methods    r   rl   rm   w  s&    Vt^ &
zFIIOO8
 &
r   z%weight_preprocess should be nn.Layer.z"act_preprocess should be nn.Layer.z#weight_quantize should be nn.Layer.z act_quantize should be nn.Layer.)	r+   r,   r-   r.   r/   weight_pre_layeract_pre_layerweight_quant_layeract_quant_layerN)r5   r6   r   r   r   r   tuple_quantizable_layer_typerC   str_kwargs)r<   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   rP   quantize_typeact_quantize_type
bits_checklayer_checkr?   s   `               r   r6   !ImperativeQuantizeInputs.__init__5  s   $ 	<M  %"?"?=
9T9 (- -
 0-
 (
$ 11Euc**T999: 89:: 2
 6yA $<<$5	
 11E0F G2 2		
6 (< 	
45M4N O= =	
< L 	 +&&O(OO&/** 	
7	
*
 233 	
3	
3 /00 	
0	
0 011 	
1	
1 -.. 	
.	
.
 %9(@&.& 71"71

r   c                 x   [        U[        R                  R                  5      (       d   S5       eUR	                  5        Hv  u  p#[        X0R
                  5      (       a   [        US5      (       a  UR                  SL a  MA  [        R                  " X5      u  pEU R                  U5      n[        XEU5        Mx     g)z
Quantize the weights and activations to calculate for specific
layers.

Args:
    model(paddle.nn.Layer): The target model which would
        calculate the input quantization scale.

Returns:
    None
rB   
skip_quantTN)rC   rD   rE   rF   named_sublayersrv   hasattrr   r   find_parent_layer_and_sub_name_get_input_quantized_layersetattr)r<   rH   name	cur_layerparent_layersub_namecur_quant_layers          r   rG   ImperativeQuantizeInputs.apply  s     %11 	
@	
1  %446ODi)E)EFF	<00((D0%*%I%I&"L #==iHOLO<  7r   c                     S nU R                   R                  5        H  u  p4[        X5      (       d  M  SU-   n  O   Uc   SUR                  5        S35       e[        R
                  U   " U40 U R                  D6$ )N	Quantizedz
The layer rc   )r   itemsrC   	full_namer   __dict__rx   )r<   rP   quant_layer_namekeyvalues        r   r   3ImperativeQuantizeInputs._get_input_quantized_layer  s    --335JC%''#.#4  6  + 	
*++KL	
+ $$%56uMMMr   )rx   rv   r   r   )
rU   rV   rW   rX   rY   r6   rG   r   rZ   r[   r\   s   @r   r8   r8   /  sA      G&!9 $!"\
|=>N Nr   r8   c                   X   ^  \ rS rSrSrSU 4S jjrS rSS jrS rS r	S r
S	 rS
rU =r$ )r:   i  z0
Calculate the output scales for target layers.
c                 F   > [         TU ]  5         Xl        X l        X0l        g)a  
The constructor for ImperativeQuantizeOutputs.

Args:
    moving_rate(float): The decay coefficient of moving average.
                        The default value is 0.9.
    activation_bits(int, optional): quantization bit number for activation. Default is 8.
N)r5   r6   _moving_rate_activation_bits_onnx_format)r<   r/   r.   r=   r?   s       r   r6   "ImperativeQuantizeOutputs.__init__  s"     	' /'r   c                    [        U[        R                  R                  5      (       d   S5       eUR	                  5        H  u  p#SU;   a  M  U R                  U5      (       d  M%  [        R                  " X5      u  pESn[        U[        [        R                  5      5      (       a   [        R                  " X0R                  US9nO[        R                  " X0R                  US9n[        XEU5        M     g)a  
Insert the `moving_average_abs_max_scale` layers to calculate the
output scales for specific layers in the dygraph model.

Args:
    model(paddle.nn.Layer): The target model which would be
        calculate the output quantization scale.

Returns:
    None
rB   _act_preprocessN)reduce_type)rC   rD   rE   rF   r   _is_target_layerr   r   ru   fake_quant_output_layersr   FakeQuantMAOutputScaleLayerr   MAOutputScaleLayerr   )r<   rH   cur_namer   r   r   r   r   s           r   rG   ImperativeQuantizeOutputs.apply  s     %11 	
@	
1 $)#8#8#:H H,((33%*%I%I&"L K)U5+I+I%JKK"."J"J00k# #/"A"A00k# LO<+ $;r   c           	         [        U[        R                  R                  5      (       d   S5       eU(       a  [        R                  R                  XS9  [        R                  R                  " SXUS.UD6  Sn[        R                  " 5       (       a  Sn[        R                  " 5         [        R                  " 5       n[        R                  R                  5       n[        R                  R                  U5      n[        R                  R!                  U5      n	[        R                  R#                  U5      n
U
[$        -   nU
[&        -   n[        R                  R)                  U	UUUS9u  nnnU R*                  (       d  U R-                  XU5        [/        [        R0                  " UR2                  5      SS9nUR5                  5        HQ  nUR7                  5        H*  nUR9                  5       S:X  d  M  UR;                  U5        M,     UR=                  5         MS     UR?                  5       nU RA                  U5        SnO[/        [        R0                  " UR2                  5      SS9n[C        XvU RD                  S	9nUR5                  5        H  nSUl#        URI                  U5        M     [K        Xv5      nUR5                  5        H  nSUl#        URI                  U5        M     UR?                  5       nSn[M        U5        S
nUc  SnO.URO                  S5      (       a  URQ                  SS5      S   nOUn[        R                  RS                  U	U5      nU Vs/ s H"  nURU                  5       RW                  U5      PM$     nn[        R                  RY                  UUUUUR[                  5       US9  U(       a  [        R\                  " 5         g
g
s  snf )a  
Save the quantized model for the inference.

Args:
    model (Layer): The model to be saved.
    path (str): The path prefix to save model. The format is
        ``dirname/file_prefix`` or ``file_prefix``.
    input_spec (list[InputSpec|Tensor], optional): Describes the input
        of the saved model's forward method, which can be described by
        InputSpec or example Tensor. If None, all input variables of
        the original Layer's forward method would be the inputs of
        the saved model. Default None.
    **config (dict, optional): Other save configuration options for
        compatibility. We do not recommend using these configurations,
        they may be removed in the future. If not necessary, DO NOT use
        them. Default None.
        The following options are currently supported:
        (1) output_spec (list[Tensor]): Selects the output targets of
        the saved model. By default, all return variables of original
        Layer's forward method are kept as the output of the saved model.
        If the provided ``output_spec`` list is not all output variables,
        the saved model will be pruned according to the given
        ``output_spec`` list.

Returns:
    None
rB   )rR   )rP   rQ   rR   FT)executormodel_filenameparams_filename)for_testmoving_average_abs_max_scale)
quant_bitsNrH   r   .r   r   )r   program
clip_extrar4   )/rC   rD   rE   rF   jit	to_staticsavein_dynamic_modeenable_staticr   CPUPlacestaticglobal_scopeExecutorosrQ   dirnamebasenameINFER_MODEL_SUFFIXINFER_PARAMS_SUFFIXload_inference_modelr   _gather_scalesr   Graphdescall_sub_graphsall_op_nodesr   safe_remove_nodesresolve_hazard
to_program_set_skip_quant_attrr   r   	_for_testrG   r   r   endswithrsplitjoinglobal_blockvarsave_inference_modelclonedisable_static)r<   rH   rQ   rR   rS   is_dynamic_modeplacescopeexer   r   r   r   infer_programfeed_target_namesfetch_targetsgraph	sub_graph_opr   transform_passquant_weight_pass
model_namepath_prefixr   	feed_varss                             r   rO   .ImperativeQuantizeOutputs.save_quantized_model  sM   8 %11 	
@	
1 JJ   >

Pe:PP!!##"O  "**,mm$$U+''//$'77##D)!$66"%88 MM..)+	 / 
		
   mD DJJ}'9'9:UKE"113	$113Cxxz%CC!33C8 4 ((*	 4
 ",,.M%%m4JDJJ}'9'9:UKE8)>)>N #113	&*	#$$Y/ 4 !0 ="113	&*	#!''	2 4 ",,.MJ,];
! J$$Z00'..sA6q9J'Jggll7J7?P
?PtM&&(,,T2?P 	 
 	**!'')! 	+ 	
 !!# 
s   !)Oc                     [        U[        R                  R                  5      (       d  gU R                  (       a,  [        U[        [        R                  5      5      (       a  S$ S$ Sn[        R                  " U5      (       a*  [        U[        [        R                  5      5      (       d  Sn[        U[        [        R                  5      5      (       a  Sn[        U[        R                  R                  R                  5      (       a  SnU$ )z5
Whether the layer needs to calculate output scales.
FT)rC   rD   rE   rF   r   ru   r   fake_quant_wrap_layersis_leaf_layerfake_quant_leaf_layersquantFloatFunctionalLayer)r<   rP   flags      r   r   *ImperativeQuantizeOutputs._is_target_layerq  s    
 %11 eU5+G+G%HII   u%%j5556/
 /
 DeU5#?#?@AADeVYY__AABBDr   c                 D   ^^^ UU4S jnUUU4S jnU" 5         U" 5         g)zu
Get all scales from fake ops, save them into the corresponding ops
and delete all moving_average_abs_max_scale ops.
c                    > / n / [         R                  QSPnT
R                   H9  nUR                   H&  nUR                  U;  d  M  U R                  U5        M(     M;     U  H  n[        U5       H  n[         R                  " UR                  U5      nUc  M)  SUR                  ;   d  UR                  S:X  d  MK  UR                  S5      S   n[         R                  " TU5      n[         R                  " U5      n[        X45      u  pUR                  U[        U	5      -   S-   U5        UR                  SS5        M     M     g )Nr   quantize_dequantizeOutScaler   
_thresholdwith_quant_attrT)r   !fake_quantize_dequantize_op_typesblocksopstyper   r
   find_previous_opblockoutputload_variable_datafp_numpy_to_naiver	   	_set_attrrw   )
target_opsskip_opsr   opin_var_nameprevious_op
scale_namein_scaleargnameindexr   r   s             r   _gather_input_scaleEImperativeQuantizeOutputs._gather_scales.<locals>._gather_input_scale  s$   J88.H !))Bwwh."))"- $ (
 !#:2#>K"'"8"8;"OK".-1A1AA&++/MM%0%7%7
%CA%F
#(#;#;E:#N#(#:#:8#D)>r)O#c%j0<? %6= $? !r   c                  ~  > / n TR                    H9  nUR                   H&  nUR                  S:X  d  M  U R                  U5        M(     M;     U  GHj  nUR	                  S5      S   nUR                  S5      S   nUR                  n[        R                  " X5      n[        R                  " X5      nUR                  S5      S   n[        R                  " TU5      n[        R                  " U5      nUR                  S:w  aW  [        XS5      n	U	bI  U	u  pUR                  U
[        U5      -   S-   U5        UR                  SU5        UR                  S	S
5        U HX  nUR                  XC5        [!        [#        T5      5       H,  nTU   R$                  U:X  d  M  UR'                  U5      TU'   M.     MZ     GMm     g )Nr   Xr   Outr   feedr   out_thresholdr   T)r   r   r   r   inputr   r   r   r   find_next_opsr   r   r   r   rw   _rename_inputrangelenr   r   )r   r   r   r   out_var_namer   next_opsout_scale_name	out_scaleresr   r   next_opir   r   r   s                 r   _gather_output_scaleFImperativeQuantizeOutputs._gather_scales.<locals>._gather_output_scale  s   J ))Bww"@@"))"- $ (
 ! hhsmA.!yy/2#44UH ..uC!#:!6q!9!44UNK	!33I>	##v-0JC),#--#c%j0<? $--oyI#--.?F'G)),D #3}#56(+00L@/4yy/EM!, 7	  (+ !r   Nr4   )r<   r   r   r   r   r  s    ```  r   r   (ImperativeQuantizeOutputs._gather_scales  s    	>8"	FH 	r   c                     UR                    HR  nUR                   H?  nU R                  X#5      (       d  M  UR                  SS5        UR                  SS5        MA     MT     g)z
Label the skip quantized ops.
r   Tr   N)r   r   _is_skip_quant_opr   )r<   r   r   r   s       r   r   .ImperativeQuantizeOutputs._set_skip_quant_attr  sN     ^^Eii))%44LLt4LL!2D9   $r   c                     / SQnUR                   U;  a  gUR                   Vs/ s H  n[        R                  " X5      PM     nn[	        S U 5       5      $ s  snf )z
The input op should be skipped quantization.
1. the type of input op should be conv2d, depthwise_conv2d or matmul
2. the previous ops of the input op are not fake_quantize_dequantize ops
)conv2ddepthwise_conv2dmatmulconv2d_transposeFc              3   r   #    U  H-  nUS L=(       a    UR                   [        R                  ;  v   M/     g 7frL   )r   r   r   )r`   r   s     r   ra   >ImperativeQuantizeOutputs._is_skip_quant_op.<locals>.<genexpr>  s;      
 # dN GuFFFG"s   57)r   input_arg_namesr   r   any)r<   r   in_optarget_op_typesarg_nameprevious_opss         r   r  +ImperativeQuantizeOutputs._is_skip_quant_op  sp    
 ::_, "11
1 ""531 	 
  
 #
 
 	
	
s    A)r   r   r   )r(   r'   FrL   )rU   rV   rW   rX   rY   r6   rG   rO   r   r   r   r  rZ   r[   r\   s   @r   r:   r:     s5    (%=Nu$n:GR:
 
r   r:   )r   rD   paddle.base.frameworkr   paddle.frameworkr   paddle.nn.quantr   %static.quantization.quantization_passr   r   static.quantization.utilsr	   r
   r   r    r   r   r   r   r   r    r8   r:   r4   r   r   <module>r,     sc    
  ) ! (    " 3x xvNN NNbx
 x
r   