Ë
    g^(h$V ã                   ó’  — d dl Z d dlZd dlmZ d dlmZmZmZ d dlZd dl	m
Z
 d dlmZmZmZmZmZmZ d dlmZmZmZ d dlmZmZmZ d dlmZmZ d d	lmZmZ d d
l m!Z! d dl"m#Z#m$Z$ d dl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ d dl,m-Z-m.Z.m/Z/m0Z0m1Z1 d dl2m3Z3 d dl4m5Z5m6Z6 d dl7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@mAZA ddlBmCZC ddlDmEZEmFZFmGZGmHZH ddlImJZJmKZKmLZL ddlMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZ g d¢Z[e\e]ej¼                  dgZ_ejÀ                  ejÂ                  ejÄ                  ejÆ                  ejÈ                  ejÊ                  ejÌ                  ejÎ                  ejÐ                  ejÒ                  g
Zj ejÖ                  ejº                  ¬«      ZlejÚ                  jÜ                  jÞ                  jà                  jâ                  ejÚ                  jÜ                  jÞ                  jà                  jâ                  dœZrejÚ                  jÜ                  jÞ                  jæ                  jâ                  ejÚ                  jÜ                  jÞ                  jæ                  jâ                  dœZtdee)e(f   fd„Zude6deve6e*f   d evewejð                  jò                  f   d!ee*   fd"„Zzd#ee*   d$eve'ef   d%e^fd&„Z{	 dnd'ed(e^d)ed*e^d+e^d,e^d!e^fd-„Z|d.e6d evewejð                  jò                  f   d!e^fd/„Z}d0ee   d!e~eejþ                     e^f   fd1„Z€de8d.e6d2ed3ed4ed!e^fd5„Z�d.e6d2ed3ed!e^fd6„Z‚d.e6d evewejð                  jò                  f   d$eve'ef   fd7„Zƒd8ee1   d9ee„e6      d2ed4ed!e^f
d:„Z…d.e6d evewejð                  jò                  f   d;e=d<ed=ee   d!e~e!e~ed>f   e=ee   f   fd?„Z†d@ejð                  jò                  dAeve1e‡ejð                  jò                     f   d!dfdB„Zˆd9e0dCe‰ew   fdD„ZŠd.e6d0edEejð                  jò                  d evewejð                  jò                  f   dFe5d!e6fdG„Z‹d9e0dHe6d2edIeeL   d4ed evewejð                  jò                  f   dJeve6e^f   dKe‰e6   d!dfdL„ZŒd.e6d2edIeeL   d evewejð                  jò                  f   d4edJeve6e^f   d!evewef   fdM„Z�de6d evewejð                  jò                  f   d$eve'ef   d%e^d!ee   f
dN„ZŽde6d evewejð                  jò                  f   d$eve'ef   d%e^d!eejþ                     f
dO„Z�de6d.e6d evewejð                  jò                  f   d$eve'ef   d%e^d!ee   fdP„Z�	 dod.ee6ef   de8d2edEejð                  jò                  d evewejð                  jò                  f   dFe5dIeeL   d;e=d$eve'ef   d%e^d4ee   d!e8fdQ„Z‘	 dod.e6d2edEejð                  jò                  d evewejð                  jò                  f   dFe5dIeeL   d;e=d$eve'ef   d%e^d4ee   d!dfdR„Z’d.e6dSedEejð                  jò                  d evewejð                  jò                  f   dFe5dTe^d!dfdU„Z“d.e6dEejð                  jò                  d evewejð                  jò                  f   dFe5d$eve'ef   d%e^d!ee6   fdV„Z”dWe6dEejð                  jò                  d evewejð                  jò                  f   dFe5d$eve'ef   d%e^d!dfdX„Z•d.e6dYeejþ                  e‡f   dZeveweAf   d!dfd[„Z–dFe5dZeveweAf   d!dfd\„Z—d.e6dEejð                  jò                  d evewejð                  jò                  f   d!e^fd]„Z˜d.e6dEejð                  jò                  d evewejð                  jò                  f   fd^„Z™d.e6d2ed evewejð                  jò                  f   d;e=fd_„ZšdEe3dZeveweAf   d`evewef   d;e=daevewef   d4edbe‰ew   d%e^d!ee6   fdc„Z›dEejð                  jò                  d%e^d evewejð                  jò                  f   dZed;e=d4ed!dfdd„Zœdee3d`evewef   dfevewe~ewe‡f   f   d;e=dgevewef   dhe!d%e^dbe‰ew   d!dfdi„Z�	 	 	 	 dpdEe3dhee!evewef   f   d%e^dfevewe~ewe‡f   f   dje~ed>f   d;ee=evewef   df   dkee!evewef   df   d4eeevewef   df   dle^d!e3fdm„Zžy)qé    N)Úasdict)ÚAnyÚOptionalÚUnion)Ú
FakeTensor)Ú_DerivedObserverOrFakeQuantizeÚFixedQParamsFakeQuantizeÚFixedQParamsObserverÚObserverBaseÚObserverOrFakeQuantizeÚPlaceholderObserver)ÚBackendConfigÚDTypeConfigÚget_native_backend_config)Ú&get_fusion_pattern_to_root_node_getterÚget_module_to_qat_moduleÚget_pattern_to_dtype_configs)Ú_is_activation_post_processÚ_PartialWrapper)Ú_is_reuse_input_qconfigÚ
QConfigAny)ÚQConfigMapping)ÚconvertÚpropagate_qconfig_)ÚDerivedQuantizationSpecÚ
EdgeOrNodeÚFixedQParamsQuantizationSpecÚQuantizationSpecÚQuantizationSpecBaseÚSharedQuantizationSpec)Ú_parent_nameÚget_qconfig_dtypesÚget_swapped_custom_module_classÚNodePatternÚPattern)ÚGraphModule)ÚGraphÚNode)ÚArgumenté   )Úis_equalization_observerÚnode_supports_equalization)ÚPrepareCustomConfigÚStandaloneModuleConfigEntry)Ú_find_matchesÚ_MatchResultWithQConfig)Ú_sorted_patterns_dict)Ú_generate_node_name_to_qconfigÚ_get_flattened_qconfig_dictÚ_update_qconfig_for_fusionÚ_update_qconfig_for_qat)Ú_default_root_node_getterÚ!_get_pattern_to_quantize_handlersÚQuantizeHandler)Ú3_insert_dequant_stubs_for_custom_module_lstm_outputÚ_is_custom_module_lstmÚ+_maybe_get_custom_module_lstm_from_node_argÚ+_qconfig_satisfies_dtype_config_constraintsÚall_node_args_have_no_tensorsÚassert_and_get_unique_deviceÚget_custom_module_class_keysÚget_new_attr_name_with_prefixÚ(get_non_observable_arg_indexes_and_typesÚnode_arg_is_biasÚnode_arg_is_weightÚNON_QUANTIZABLE_WEIGHT_OPSÚObservedGraphModuleAttrs)Úinsert_observers_for_modelÚprepareÚ propagate_dtypes_for_known_nodes©Údtype©Úinput_act_obs_or_fq_ctrÚoutput_act_obs_or_fq_ctrÚ
quant_specc                 óB   — t        | «      }t        j                  |«      S ©N)r   ÚcopyÚdeepcopy)rN   Úkwargs_dicts     ú^/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/ao/quantization/fx/prepare.pyÚ_get_observer_kwargsrU   w   s   € ô ˜Ó$€KÜ�=‰=˜Ó%Ð%ó    ÚargÚinput_qspec_mapÚnamed_modulesÚreturnc                 óv   — t        | |«      r| j                  d   } t        | |«      rŒ|j                  | d «      S )Nr   )Ú _is_activation_post_process_nodeÚargsÚget)rW   rX   rY   s      rT   Ú_get_qspec_for_argr_   ~   s:   € ô
 +¨3°Ô
>Ø�h‰h�q‰kˆô +¨3°Õ
>à×Ñ˜s DÓ)Ð)rV   Úquantization_specÚobs_or_fq_mapÚis_qatc                 óŽ  — | €yt        | t        «      r0| j                  }||v sJ d|› d|j                  «       › �«       ‚||   S t        | t        «      r‚| j
                  | j                  | j                  | j                  | j                  | j                  dœ}| j                  }|D �cg c]  }||   ‘Œ	 }}||d<    t        j                  d
i |¤Ž«       S t        | t        «      rDt        | «      }t!        j                  d
i |¤Ž}|r t#        j                  |¬«      «       S  |«       S t        | t$        «      sJ ‚| j&                  }	t        | «      }|j)                  d«       |	}
t        |	t*        «      r|	j,                  j.                  }
d|
j0                  vr|j)                  d	«         |	j                  d
i |¤Ž«       S c c}w )ad  Create observer or fake quantize objects based on quantization spec

    Args:
       quantization_spec: used to store parameters to create the observer or fake quantizer
       obs_or_fq_map: this is a map from edge/output to the corresponding observer/fake_quant
       instance, it may be reused for different edge/output depending on configuration
    NzTplease make sure only refer to edge or node that has observer/fake_quant inserted: 'z	' not in
)rJ   Úderive_qparams_fnÚ	quant_minÚ	quant_maxÚqschemeÚch_axisÚ
obs_or_fqs)ÚobserverÚobserver_or_fake_quant_ctrÚ
PerChannelrh   © )Ú
isinstancer    Úedge_or_nodeÚkeysr   rJ   rd   re   rf   rg   rh   Úderived_fromr   Ú	with_argsr   rU   r
   r	   r   rk   Úpopr   ÚpÚfuncÚ__name__)r`   ra   rb   ro   ÚkwargsÚedge_or_nodesÚkri   Úobserver_ctrrk   Úobs_or_fq_classs              rT   Ú_create_obs_or_fq_from_qspecr|   ˆ   sÛ  € ð Ð ØÜÐ#Ô%;Ô<Ø(×5Ñ5ˆØ˜}Ñ,ð 	
ð.Ø.:¨^¸:Àm×FXÑFXÓFZÐE[ð]ó	
Ð,ð ˜\Ñ*Ð*Ü	Ð%Ô'>Ô	?ð '×,Ñ,Ø!2×!DÑ!DØ*×4Ñ4Ø*×4Ñ4Ø(×0Ñ0Ø(×0Ñ0ñ
ˆð *×6Ñ6ˆØ0=Ö>¨1�m AÓ&Ð>ˆ
Ð>Ø)ˆˆ|ÑØAÔ-×7Ñ7ÑA¸&ÑAÓCÐCÜ	Ð%Ô'CÔ	DÜ%Ð&7Ó8ˆÜ+×5Ñ5Ñ?¸Ñ?ˆÙØLÔ+×5Ñ5¸|ÔLÓNÐNá“>Ð!äÐ'Ô)9Ô:Ð:Ð:Ø!2×!MÑ!MÐÜ!Ð"3Ó4€FØ
‡J�JÐ+Ô,ð 1€OÜÐ,¬oÔ>Ø4×6Ñ6×;Ñ;ˆØ˜?×3Ñ3Ñ3Ø�
‰
�9ÔØ9Ð/Ð%×/Ñ/Ñ9°&Ñ9Ó;Ð;ùò- ?s   Â)GÚprev_output_dtypeÚprev_output_is_dynamicÚcur_target_dtypeÚcur_target_is_dynamicÚreuse_input_obs_or_fqÚis_zeroth_argc                 óœ   — |r|t         v s
J d|› �«       ‚| t        vsJ ‚|S |ry|t         v r!| t         t        j                  gz   v xr || k7  S y)a×  
    note: we will treat "not specified" as torch.float for now
    utility function that checks if we should insert an observer or fake quant node
    base on the requested dtype for the nodes from user

    is_zeroth_arg: we only dynamically quantize the first arg of the node right now
      this should be removed when we enable configuring dynamic quantization
      for a specific argument, this can be removed if we deprecate fx graph mode
      quantization

    z6Expected cur_target_dtype to be torch.float, but got: F)Ú_OBS_DTYPE_LISTÚ_DO_NOT_OBS_DTYPE_LISTÚtorchÚfloat)r}   r~   r   r€   r�   r‚   s         rT   Ú_needs_obs_or_fqrˆ   Á   sx   € ñ, à¤Ñ/ð	WàCÐDTÐCUÐVó	WØ/à Ô(>Ñ>Ð>Ð>ØÐÙØàœ?Ñ*à¤´E·K±K°=Ñ!@Ð@ò 6Ø Ð$5Ñ5ð	
ð rV   Únodec                 ó²   — t        | t        j                  j                  «      xr2 | j                  dk(  xr! t        |t        | j                  «         «      S )NÚcall_module)rn   r†   Úfxr(   Úopr   ÚstrÚtarget)r‰   rY   s     rT   r\   r\   ê   sI   € ô 	�4œŸ™Ÿ™Ó'ò 	IØ�G‰G�}Ñ$ò	Iä'¨´c¸$¿+¹+Ó6FÑ(GÓHðrV   Ú	obs_or_fqc                 ó:   — | €y| j                   t        | dd«      fS )zgGiven a constructor for observer or fake quant module, returns
    a Tuple of dtype and is_dynamic
    )NFÚ
is_dynamicF)rJ   Úgetattr)r�   s    rT   Ú_get_dtype_and_is_dynamicr”   ô   s%   € ð ÐØà�‰¤¨	°<ÀÓ GÐGÐGrV   ÚqconfigÚdtype_configÚbackend_configc                 óh  ‡‡‡‡— t        | t        t        f«      rt        ˆˆˆˆfd„| D «       «      S t        | t        «      syt        ‰| «      }t        ‰| «      }| xr | }|r‘‰j                  d   j                  d«      }|r |«       nd}	t        |	«      \  }
}‰j                  du xsJ ‰j                  |
k(  xr9 t        ‰j                  «      t        |«      k(  xr t        ‰‰j                  «      S |rm‰j                  d   j                  dd«      }|r |«       nd}t        |«      \  }}‰j                  }||k(  }t        ‰‰j                   d¬«      }|du xs |xr |S ‰j                  d   j                  d	d«      }|r |«       nd}t        |«      \  }}‰j"                  }|du xs ||k(  S )
z\Check if the configured qconfig for the argument
    is supported by the backend or not
    c              3   ó<   •K  — | ]  }t        |‰‰‰‰«      –— Œ y ­wrP   )Ú(_is_input_arg_dtype_supported_by_backend)Ú.0Úar—   r–   r‰   r•   s     €€€€rT   ú	<genexpr>z;_is_input_arg_dtype_supported_by_backend.<locals>.<genexpr>  s+   øè ø€ ò 
ð ô 5Ø�4˜ ,°÷ñ
ùs   ƒTÚtarget_dtype_inforL   NÚweight_obs_or_fq_ctrF)Úis_activationÚbias_obs_or_fq_ctr)rn   ÚlistÚtupleÚallr(   rC   rB   Úmetar^   r”   Úinput_dtypeÚboolr’   r<   Úinput_dtype_with_constraintsÚweight_dtypeÚweight_dtype_with_constraintsÚ
bias_dtype)rW   r‰   r•   r–   r—   Ú	is_weightÚis_biasr    rL   Úinput_act_obs_or_fqÚqconfig_dtypeÚqconfig_is_dynamicrŸ   Úweight_obs_or_fqÚqconfig_weight_dtypeÚ_Úbackend_config_weight_dtypeÚdtype_matchesÚqconfig_satisfies_constraintsr¡   Úbias_obs_or_fqÚqconfig_bias_dtypeÚbackend_config_bias_dtypes    ````                  rT   rš   rš     s  û€ ô �#œœe�}Ô%Üö 
ð ô	
ó 
ð 	
ô �cœ4Ô Øä" 4¨Ó-€IÜ˜t SÓ)€GØ!�MÒ1¨' k€MÙØ"&§)¡)Ð,?Ñ"@×"DÑ"DØ%ó#
Ðñ *AÑ#Ô%Àdð 	ô -FØó-
Ñ)ˆÐ)ð
 ×(Ñ(¨DÐ0ò 
Ø×$Ñ$¨Ñ5ò Ü�\×,Ñ,Ó-´Ð6HÓ1IÑIòä;Ø˜×BÑBóð	
ñ 
à#Ÿy™yÐ)<Ñ=×AÑAØ" Dó 
Ðñ 6JÑ/Ô1ÈtÐÜ";Ð<LÓ"MÑÐ˜aØ&2×&?Ñ&?Ð#Ø,Ð0KÑKˆÜ(SØ�\×?Ñ?Èuô)
Ð%ð +¨dÐ2ò 
ØÒ;Ð;ð	
ð
 "ŸY™YÐ':Ñ;×?Ñ?Ø  $ó
Ðñ 2DÑ+Ô-ÈˆÜ 9¸.Ó IÑÐ˜AØ$0×$;Ñ$;Ð!à%¨Ð-ò ?Ø!Ð%>Ñ>ð	
rV   c                 ó  — |j                   }d}| j                  d   j                  dt        «      }|r |«       nd}t	        |«      \  }}|rt
        j                  }||k(  }t        ||j                  «      }	|du xs |xr |	S )zZCheck if the configured qconfig for the output
    is supported by the backend or not
    Nrž   rM   )	Úoutput_dtyper¥   r^   Ú_DEFAULT_FP32_OBS_OR_FQ_CTRr”   r†   Úfloat32r<   Úoutput_dtype_with_constraints)
r‰   r•   r–   Úbackend_config_output_dtypeÚqconfig_output_dtyperM   Úoutput_act_obs_or_fqÚqconfig_output_is_dynamicrµ   r¶   s
             rT   Ú%_is_output_dtype_supported_by_backendrÃ   H  s¯   € ð #/×";Ñ";Ðð  ÐØ#Ÿy™yÐ)<Ñ=×AÑAØ"Ô$?ó Ðñ '?Ñ Ô"ÀDð ô 7PØó7Ñ3ÐÐ3ñ !Ü$Ÿ}™}ÐØ(Ð,GÑG€MÜ$OØ�×;Ñ;ó%Ð!ð '¨$Ð.ò ØÒ7Ð7ðrV   c                 ó  — t        | |||«      }t        | j                  «      dkD  r\t        | j                  d   t        «      r?|t
        j                  t
        j                  fv r| j                  d   j                  dk(  ryy)zÓCheck if observer in same graph
    when the node output is not fp32 and input is 'placeholder'
    the input is assumed to be quantized, so it is observed
    in a different place rather than not observed.
    r   ÚplaceholderFT)	Ú_get_arg_target_dtype_as_outputÚlenr]   rn   r(   r†   Úquint8Úuint8r�   )r‰   rY   ra   rb   Únode_output_dtypes        rT   Ú_is_observer_in_same_graphrË   m  sj   € ô 8Øˆm˜]¨FóÐô ˆ4�9‰9ƒ~˜Òœj¨¯©°1©´tÔ<à¤%§,¡,´·±Ð!<Ñ<Ø—	‘	˜!‘—‘ =Ò0àØrV   ÚpatternÚmatched_node_patternc           	      óª  — |�| €y|�t        |«      dk\  sJ ‚t        |«      }|j                  | g «      }t        |«      }|j                  | t        «      } ||«      }|}	|d   }
|D ]j  }d}t        |	j                  «      t        |	j                  j                  «       «      z   D ]  }|xr t        ||	|||«      }Œ |xr t        |
||«      }|sŒj y y)z¹Check if the dtype configuration of a pattern is supported by
    the backend or not, and whether the qconfig satisfies constraints
    specified in the corresponding dtype config.
    Tr*   r   F)rÇ   r   r^   r   r6   r¢   r]   rw   Úvaluesrš   rÃ   )rÌ   rÍ   r•   r—   Úpattern_to_dtype_configsÚdtype_configsÚpattern_to_root_node_getterÚroot_node_getterÚ	root_nodeÚ
input_nodeÚoutput_noder–   Ú	supportedrW   s                 rT   Ú9_is_pattern_dtype_config_and_qconfig_supported_by_backendrØ   „  s  € ð Ð  ØØÐ+´Ð4HÓ0IÈQÒ0NÐNÐNÜ;¸NÓKÐØ'?×'CÑ'CÀGÈRÓ'P€MÜ"HÈÓ"XÐà2×6Ñ6ØÔ*óÐñ !Ð!5Ó6€IØ€JØ& qÑ)€KØ%ò ˆàˆ	Ü˜
Ÿ™Ó(¬4°
×0AÑ0A×0HÑ0HÓ0JÓ+KÑKò 	ˆCØ!ò Ô&NØ�Z ¨,¸ó'‰Ið	ð
 ò 
Ô"GØ˜ ,ó#
ˆ	ò Ùðð rV   Úprepare_custom_configÚparent_qconfigÚparent_backend_config.c                 ó–  — t        | j                  «      }t        ||   «      }t        dddd«      }|j                  j                  ||«      }|j                  j                  ||«      }|j                  xs t        «       j                  |«      }|j                  }	|j                  xs
 t        «       }|j                  xs |}
||	||
fS )z©
    Returns the standalone module QConfigMapping and PrepareCustomConfig
    for `node`, assuming that the module pointed to by `node` is
    a standalone modules.
    Nrm   )rŽ   r�   Útyper.   Ústandalone_module_classesr^   Ústandalone_module_namesÚqconfig_mappingr   Ú
set_globalÚexample_inputsrÙ   r-   r—   )r‰   rY   rÙ   rÚ   rÛ   Úmodule_nameÚmodule_typeÚconfig_entryrà   râ   r—   s              rT   Ú_get_standalone_module_configsræ   «  sÑ   € ô �d—k‘kÓ"€KÜ�} [Ñ1Ó2€Kä.¨t°R¸¸tÓD€LØ(×BÑB×FÑFØ�\ó€Lð )×@Ñ@×DÑDØ�\ó€Lð #×2Ñ2ò ´nÓ6F×6QÑ6QØó7€Oð "×0Ñ0€NØ(×>Ñ>ÒWÔBUÓBWÐØ!×0Ñ0ÒIÐ4I€NØ˜^Ð-BÀNÐSÐSrV   ÚrootÚmodule_to_qat_modulec                 ó"   — t        | |dd¬«       y )NTF)ÚmappingÚinplaceÚremove_qconfig)r   )rç   rè   s     rT   Ú_qat_swap_modulesrí   Í  s   € ô ˆDÐ.¸ÈUÖSrV   Úsc                 ó°   — t        | t        «      r|j                  | j                  «       y t        | t        t
        f«      r| D ]  }t        ||«       Œ y y rP   )rn   r(   ÚaddÚnamer¢   r£   Ú_add_matched_node_name_to_set)rÍ   rî   Ú
maybe_nodes      rT   rò   rò   Ó  sM   € ÜÐ&¬Ô-Ø	�‰Ð"×'Ñ'Õ(Ü	Ð(¬4´¨-Ô	8Ø.ò 	9ˆJÜ)¨*°aÕ8ñ	9ð 
9rV   ÚmodelÚgraphc                 ó>  — t        |«      }|r|j                  |«       t        |«      r| j                  dz   }nd}t	        |«      } ||«      }t        |||«       |||<   |j                  | «      5  |j                  d|| fi «      }	ddd«       |	S # 1 sw Y   	S xY w)z±
    Attaches `obs_or_fq` to `model`, and creates a node which calls
    `obs_or_fq` on the output of `node`.

    obs_or_fq: an instance of Observer or FakeQuantize module
    Ú_equalization_process_Úactivation_post_process_r‹   N)r>   Útor+   rñ   r@   ÚsetattrÚinserting_afterÚcreate_node)
r‰   r�   rô   rY   rõ   Úmodel_deviceÚprefixÚget_new_obs_or_fq_nameÚobs_or_fq_nameÚnew_obss
             rT   Ú_insert_obs_or_fqr  Û  s§   € ô 0°Ó6€LÙØ�‰�\Ô"ä 	Ô*Ø—‘Ð5Ñ5‰à+ˆÜ:¸6ÓBÐÙ+¨EÓ2€NÜˆE�> 9Ô-Ø$-€M�.Ñ!Ø	×	Ñ	˜tÓ	$ñ PØ×#Ñ# M°>ÀDÀ7ÈBÓOˆ÷Pà€N÷Pà€Nús   Á2BÂBÚ	last_nodeÚqhandlerÚcache_for_no_tensor_checkÚprocessed_nodesc                 ó  — t        | t        t        f«      r| D ]  }t        ||||||||«       Œ yt        | t        «      rMt        | t        «      sJ ‚| }	|	|v ry|j                  |	«       |€yt        |	|||||«      }
|
|	j                  d<   yy)z�Sets the target_dtype_info for each node in matched_node_pattern
    Note: processed_nodes is used to ensure we only process each node once
    Nrž   )rn   r¢   r£   Ú/_set_target_dtype_info_for_matched_node_patternr(   rð   Ú%_get_target_activation_dtype_for_noder¥   )rÍ   r  r•   r  r—   rY   r  r  Únode_patternr‰   rž   s              rT   r  r  ù  s¼   € ô Ð&¬¬u¨Ô6Ø0ò 
	ˆLÜ;ØØØØØØØ)Øõ	ñ
	ô 
Ð(¬$Ô	/äÐ.´Ô5Ð5Ð5Ø#ˆØ�?Ñ"ØØ×Ñ˜DÔ!àˆ?Øô -RØØØØØØ%ó-
Ðð *;ˆ�	‰	Ð%Ò&ð1 
0rV   c           
      ó¢  — t        | ||«      }|rdddœS |�� t        |«      \  }}}	|t        j                  k(  r%|t        j                  k(  r|	st        j                  nt        j                  }
|duxr |j                  «       }|duxr |j                  «       }d}t        | t        «      rY| j                  dk(  rJ| j                  |j                  v r2|j                  | j                     j                  j                  d«      }d}t        | t        «      rY| j                  dk(  rJ| j                  |j                  v r2|j                  | j                     j                  j                  d«      }|j                  |j                  t!        j"                  |
¬«      |||j                  t%        |«      ||dœ	S t'        j&                  t(        «      S )a<  
    For each op attribute in the op's input activation, output activation,
    weight, bias - returns the settings of dtype and is_dynamic we expect
    for the `quantize` call in the reference model representation, or None
    if there is no `quantize` call needed.

    For example, if we have a node corresponding to `op0` in

      x0 -> op0 -> x1

    And we want a reference quantized representation to be

      x0 -> quant_static -> dequant -> op0 -> quant_dynamic -> dequant -> x1

    Then this function will return

      {
        "input_act_obs_or_fq_ctr": MinMaxObserver.with_args(dtype=torch.quint8, is_dynamic=False),
        "output_act_obs_or_fq_ctr": MinMaxObserver.with_args(dtype=torch.quint8, is_dynamic=False),
      }

    TODO(future PR, if needed): explicitly spell out the non-Tensor
    dtypes.
    NrK   Úcall_functionÚweightÚbiasrI   )	rL   rŸ   r¡   Úweight_indexÚ
bias_indexrM   r�   Úinput_output_share_observersÚ_is_standalone_module)r=   r"   r†   Úfloat16r‡   Úis_general_tensor_value_opÚis_standalone_modulern   r(   r�   r�   Ú!_pattern_complex_format_to_configÚ_input_type_to_indexr^   Ú
activationr  r   rr   r   rQ   Ú+_DEFAULT_FP32_QCONFIG_FOR_TARGET_DTYPE_INFO)r‰   r•   r  rY   r—   r  Úargs_have_no_tensorsÚ	act_dtyper©   Úinput_act_is_dynamicr«   r  r  r  r  s                  rT   r	  r	  0  s¸  € ô@ 9ØˆmÐ6óÐñ à'+Ø(,ñ
ð 	
ð
 ÑÜ8JÈ7Ó8SÑ5ˆ	�<Ð!5ð œUŸ]™]Ò*Ø ¤E§M¡MÒ1Ù-ô	 �MŠMô —‘ð 	ð ˜DÐ ÒJ X×%HÑ%HÓ%Jð 	#ð !)°Ð 4Ò X¸×9VÑ9VÓ9XÐàˆä�tœTÔ"Ø—‘˜?Ò*Ø—‘˜~×OÑOÑOà)×KÑKØ—‘ñç"Ñ"§3¡3 x£=ð ð ˆ
ä�tœTÔ"Ø—‘˜?Ò*Ø—‘˜~×OÑOÑOà'×IÑIØ—‘ñç"Ñ"§3¡3 v£;ð ð
 (/×'9Ñ'9Ø$+§N¡NÜ"5×"?Ñ"?ÀjÔ"QØ(Ø$Ø(/×(:Ñ(:Ü%<¸WÓ%EØ,FØ%:ñ

ð 
	
ô �9‰9Ô@ÓAÐArV   c                 ó   — t        | t        «      sJ ‚d| j                  v r$t        | j                  d   j                  ||«      S t        | |«      }d}|�!|j                  d   d   }|r	 |«       }|S d}|S t        | |«      r‰| j                  d   }t        |t        «      sJ d«       ‚d|j                  v r&t        |j                  d   j                  ||«      }|S d|j                  v sJ ‚|j                  d   d   }|r |«       nd}|S d| j                  v r$| j                  d   j                  dt        «      }nt        }|r |«       nd}|S )aC  Get the constructor for observer or fake quant object for
    the argument in the original graph as the output of previous node,
    skipping inserted observers

    We are assuming that the observers are inserted correctly, and the dtype for
    argument in quantized graph will match what is specified by the qconfig
    Úquantization_annotationNrž   rM   r   z(Currently we only support observing Node)
rn   r(   r¥   r|   Úoutput_qspecr;   r\   r]   r^   r¼   )rW   rY   ra   rb   Úcustom_module_lstm_noderM   rÁ   Úobserved_args           rT   Ú_get_output_act_obs_or_fqr"  •  sÀ  € ô �cœ4Ô Ð Ð Ø  C§H¡HÑ,Ü+Ø�H‰HÐ.Ñ/×<Ñ<¸mÈVó
ð 	
ô JØˆ]óÐð  $ÐØÐ*Ø#:×#?Ñ#?Ð@SÑ#TØ&ñ$
Ð ñ +CÑ$Ó&ð 	ðB  ÐðA IMð 	ðB  Ðô= 
*¨#¨}Ô	=Ø—x‘x ‘{ˆÜØœ$ô
ð 	6à5ó	6ð 
ð %¨×(9Ñ(9Ñ9Ü#?Ø×!Ñ!Ð";Ñ<×IÑIØØó$Ð ð0  Ðð% '¨,×*;Ñ*;Ñ;Ð;Ð;Ø'3×'8Ñ'8Ð9LÑ'MØ*ñ(Ð$ñ /GÑ(Ô*ÈDð !ð  Ðð  #§(¡(Ñ*Ø'*§x¡xÐ0CÑ'D×'HÑ'HØ*Ô,Gó(Ñ$ô (CÐ$á*BÑ$Ô&Èð 	ð  ÐrV   c                 ó>   — t        | |||«      }t        |«      \  }}|S rP   )r"  r”   )rW   rY   ra   rb   Úarg_as_output_act_obs_or_fqÚarg_as_output_target_dtyper³   s          rT   rÆ   rÆ   Ù  s5   € ô #<Øˆ]˜M¨6ó#Ðô %>Ø#ó%Ñ!Ð ð &Ð%rV   c                 ó$  — t        | t        «      sJ ‚d|j                  v rC|j                  d   j                  }t	        | ||«      }|€t        «       }|S t        |||«      }|S t        || «      }t        || «      }	| xr |	 }
d}|
r$|j                  d   j                  dt
        «      }n[|r6|j                  t        vrG|j                  d   j                  dt
        «      }n#|j                  d   j                  dt
        «      }|r |«       S dS )zcGet the observer or fake quant constructor for the Argument `arg`, as input
    to Node `node`
    r  Nrž   rL   rŸ   r¡   )rn   r(   r¥   rX   r_   r¼   r|   rC   rB   r^   r�   rD   )rW   r‰   rY   ra   rb   rX   Úinput_arg_qspecÚinput_arg_obs_or_fqr¬   r­   r    Úobs_or_fq_ctrs               rT   Ú_get_arg_as_input_act_obs_or_fqr*  è  s-  € ô �cœ4Ô Ð Ð ð ! D§I¡IÑ-ØŸ)™)Ð$=Ñ>×NÑNˆÜ,¨S°/À=ÓQˆØÐ"Ü"=Ó"?Ðð
 #Ð"ô #?Ø °ó#Ðð #Ð"ô # 4¨Ó-€IÜ˜t SÓ)€GØ!�MÒ1¨' k€MØ€MÙØŸ	™	Ð"5Ñ6×:Ñ:Ø%Ô'Bó
‰ñ 
Ø�;‰;Ô8Ñ8Ø ŸI™IÐ&9Ñ:×>Ñ>Ø&Ô(Có‰Mð Ÿ	™	Ð"5Ñ6×:Ñ:Ø Ô"=ó
ˆñ ,‰=‹?Ð5°Ð5rV   c                 óP  — t        |t        t        f«      r@g }|D ](  }t        | |||||||||	|
«      }|j	                  |«       Œ*  t        |«      |«      S t        |t        «      s|S t        |t        «      sJ ‚|}|duxr |j                  «       }|sÍd| j                  v r| j                  d   j                  }n1d| j                  v sJ ‚| j                  d   }|j                  dd«      }t        || |||	«      }t        |«      \  }}t        ||||	«      }t        |«      \  }}t        |||||t        | j                   «      dkD  xr || j                   d   u ¬«      }n³|€J ‚t#        | ||||
«      \  }}}}|j$                  }d}t'        | j                   «      D ]  \  }}||u sŒ|} n |€d}nLt)        ||||	«      }||v rt*        j,                  nt*        j.                  }||k7  xr |t*        j.                  k7  }|j0                  }|r |«       nd}|r�d} |j2                  j5                  «       D ]N  }!|!j6                  dk(  sŒ||!j8                     }"t        |"«      t        |«      k(  sŒ:|"j:                  k(  sŒJ|"}|!}  n |€J ‚|||| f<   | €t=        |||||«      }#|#}|S | }|S )	zk
    Given a `node` and an `arg`, inserts an input observer between
    `node` and `arg` if necessary.
    Nr  rž   r�   Fr   )r‚   r‹   )rn   r¢   r£   Ú-_maybe_insert_input_observer_for_arg_or_kwargÚappendrÝ   r(   r  r¥   Ú_reuse_input_obs_or_fqr^   r*  r”   r"  rˆ   rÇ   r]   ræ   Úinput_quantized_indexesÚ	enumeraterÆ   r†   rÈ   r‡   r  Úusersrp   r�   r�   rJ   r  )$r‰   rW   r•   rô   rY   rõ   r  rÙ   ra   rb   r—   Únew_arg_to_returnÚ	inner_argÚnew_inner_argÚnew_argr  r�   rž   Úarg_as_input_act_obs_or_fqÚarg_as_input_target_dtypeÚarg_as_input_target_is_dynamicr$  r%  Úarg_as_output_target_is_dynamicÚneeds_obs_or_fqr³   Úsm_prepare_custom_configÚsm_input_quantized_idxsÚcur_input_idxÚarg_idxÚarg_to_checkÚact_post_process_ctrÚexisting_obs_nodeÚmaybe_obs_nodeÚmaybe_obs_modÚnew_obs_nodes$                                       rT   r,  r,    sq  € ô& �#œœe�}Ô%ØÐØò 	4ˆIÜIØØØØØØØØ%ØØØóˆMð ×$Ñ$ ]Õ3ð	4ð Œt�C‹yÐ*Ó+Ð+ä�cœ4Ô Øˆ
Ü�cœ4Ô Ð Ð à€Gà#¨4Ð/ÒS°H×4QÑ4QÓ4SÐáð
 %¨¯	©	Ñ1Ø$(§I¡IØ)ñ%ç$Ñ$ñ "ð '¨$¯)©)Ñ3Ð3Ð3ð !%§	¡	Ð*=Ñ >Ðð %6×$9Ñ$9Ø'¨ó%Ð!ô &EØ��} m°Vó&
Ð"ô &Ð&@ÓAñ	
Ø%Ø*ô '@Ø� ¨vó'
Ð#ô &Ð&AÓBñ	
Ø&Ø+ô +Ø&Ø+Ø%Ø*Ø!Ü˜dŸi™i›.¨1Ñ,ÒD°¸¿	¹	À!¹Ð1Dô
‰ð Ð"Ð"Ð"ä,JØ�-Ð!6¸Àó-
Ñ)ˆˆ1Ð&¨ð #;×"RÑ"RÐð ˆÜ%.¨t¯y©yÓ%9ò 	Ñ!ˆG�\Ø˜sÒ"Ø '�Ùð	ð
 Ð Ø#‰Oä)HØ�] M°6ó*Ð&ð
 !Ð$;Ñ;ô —’ä—[‘[ð &ð +Ð.GÑGò=à,´·±Ñ;ð ð  '×1Ñ1Ðá&:Ñ Ô"Àð 	#ñ Ø Ðð "Ÿi™iŸn™nÓ.ò 
	ˆNØ× Ñ  MÓ1Ø -¨n×.CÑ.CÑ D�ä˜Ó'¬4Ð0JÓ+KÓKØ%×+Ñ+Ø0ó1ð 2?Ð.Ø(6Ð%Ùð
	ð *Ð5Ð5Ð5Ø%?ˆ�s˜D�kÑ"ØÐ$Ü,ØÐ/°¸ÀuóˆLð #ˆGð €Nð (ˆGà€NrV   c
                 ó   — g }
| j                   D ](  }t        | ||||||||||	«      }|
j                  |«       Œ* i }| j                  j	                  «       D ]  \  }}t        | ||||||||||	«      }|||<   Œ! t        |
«      | _         || _        y)aK  
    If needed, inserts observers to the input args and kwargs of `node`.
    Note: modifies `node` inplace.

    For example, if cur_node needs an observer after prev_node, we change from

      prev_node -> cur_node

    To

      prev_node -> obs -> cur_node

    Note: backend_config only needed for standalone_module node
    N)r]   r,  r-  rw   Úitemsr£   )r‰   r•   rô   rY   rõ   r  rÙ   ra   rb   r—   Únew_argsrW   r5  Ú
new_kwargsry   ÚkwargÚ	new_kwargs                    rT   Ú&_maybe_insert_input_observers_for_noderK  ¿  sÆ   € ð8 €HØ�y‰yò !ˆÜ?ØØØØØØØØ!ØØØó
ˆð 	�‰˜Õ ð!ð  €JØ—K‘K×%Ñ%Ó'ò "‰ˆˆ5ÜAØØØØØØØØ!ØØØó
ˆ	ð "ˆ
�1Šð"ô" �h“€D„IØ€D…KrV   Úequalization_qconfigÚ	is_branchc                 ó–  — |�t        | |«      sy|rt        j                  d| › d�«       yg }| j                  D ]}  }t	        |t
        «      rt        | |«      r|j                  |«       Œ1t        | |«      }|r|j                  n|j                  }	 |	«       }
t        ||
|||«      }|j                  |«       Œ t        |«      | _        y)zâ
    If `node` needs to be equalized, find the input/weight observers it needs in
    `equalization_qconfig`, creates them, and inserts it into `graph`.

    If `node` does not need an equalization observer, returns None.
    NzCannot equalize z  because it is part of a branch.)r,   ÚwarningsÚwarnr]   rn   r(   rB   r-  rC   r  Úinput_activationr  r£   )r‰   rL  rô   rY   rõ   rM  rG  rW   r¬   Úact_eq_process_ctrÚnew_eq_obs_modÚnew_eq_obs_nodes               rT   Ú3_maybe_insert_input_equalization_observers_for_noderU    sØ   € ð Ð#Ô+EØˆmô,ð 	áÜ�‰Ð(¨¨Ð.NÐOÔPØà€HØ�y‰yò )ˆÜ˜#œtÔ$Ô(8¸¸sÔ(CØ�O‰O˜CÔ Øä& t¨SÓ1ˆ	ñ ð !×'Ò'à%×6Ñ6ð 	ñ ,Ó-ˆÜ+Ø� ¨°uó
ˆð 	�‰˜Õ(ð%)ô* �h“€D…IrV   c                 óæ  — | j                   dk7  sJ d«       ‚d}d| j                  v r%t        | j                  d   j                  ||«      }nXd| j                  v sJ ‚| j                  d   j	                  dd«      }| j                  d   j	                  d«      }|r |«       nd}t        |«      \  }	}
d}t        t        j                  d|	|
|«      }|
rd}|xr | }|r||| <   t        | ||||«      S y)	a$  
    If `node` needs an output observer, creates it, inserts it into `graph`
    and returns it.

    If `node` does not need an output observer, returns None.

    Note: inserting dynamic quantization ops for output is not supported in fx graph mode
    quantization code path right now
    Úoutputz3observer insertion for outputs is handled elsewhereFr  rž   r  rM   N)
r�   r¥   r|   r  r^   r”   rˆ   r†   r‡   r  )r‰   rô   rY   rõ   ra   rb   r  rÁ   rM   Útarget_dtypeÚtarget_is_dynamicr�   r:  s                rT   Ú&_maybe_insert_output_observer_for_noderZ  2  s5  € ð" �7‰7�hÒÐUÐ UÓUÐà ÐØ  D§I¡IÑ-Ü;Ø�I‰IÐ/Ñ0×=Ñ=¸}Èfó 
Ñð # d§i¡iÑ/Ð/Ð/Ø#Ÿy™yÐ)<Ñ=×AÑAØ# Uó 
Ðð $(§9¡9Ð-@Ñ#A×#EÑ#EØ&ó$
Ð ñ +CÑ$Ô&Èð 	ô '@Ð@TÓ&UÑ#€LÐ#ð "Ðô 'Ü�‰�U˜LÐ*;Ð=Ró€Oñ Øˆð &ÒDÐ/CÐ+C€OáØ2ˆ�dÑÜ ØÐ&¨¨}¸eó
ð 	
ð rV   Úgraph_output_nodec           
      ó.  ‡‡‡— dt         dt        j                  j                  dt        t
        t        j                  j                  f   dt        dt         f
ˆˆˆfd„Š| j                  D �cg c]  } ‰||||«      ‘Œ }}t        |«      | _        yc c}w )zž
    If the output needs to be quantized and there are any nodes
    in the output which are not already observed, inserts observers
    for those nodes.
    ró   rô   rY   rõ   rZ   c           	      ó€  •— t        | t        «      r•t        | |‰‰«      }d}t        j                  }d| j
                  v r4| j
                  d   j                  dd«      }|� |«       }|j                  }||k7  xr |t        j                  k7  }|r|€J ‚t        | ||||«      }	|	S | S t        | t        t        f«      r5| D �
cg c]  }
 ‰|
|||«      ‘Œ }}
t        | t        «      r|S t        |«      S t        | t        «      r*i }| j                  «       D ]  \  }} ‰||||«      ||<   Œ |S | €yt        d| «      ‚c c}
w )a`  
        Navigate an arbitrary data structure of lists, tuples, dicts.
        For each container type, recurse on all inputs. Once any Node
        is found, insert an observer if needed and do not recurse further.

        For example, given a structure of

          {'foo1': [[bar1]], 'foo2': {'foo3': [[[bar3]]]}}

        we recurse down to bar1 and bar3, observe them if necessary,
        and if we inserted an observer then replace the original node
        with its observer.

        Returns the data structure with all nodes needing observation being
        replaced by their observers.
        Nrž   rL   z!Unhandled type for returned node:)rn   r(   rÆ   r†   r‡   r¥   r^   rJ   r  r¢   r£   ÚdictrF  Ú	Exception)ró   rô   rY   rõ   r%  Úobserver_modr7  Úobserver_clsÚneed_obsÚobserver_nodeÚ
inner_nodeÚresultsÚresults_dictry   Úinner_vÚ&_recursive_maybe_replace_node_with_obsrb   ra   s                  €€€rT   rh  z[_maybe_insert_observers_before_graph_output.<locals>._recursive_maybe_replace_node_with_obs‘  s‘  ø€ ô, �j¤$Ô'ä)HØ˜M¨=¸&ó*Ð&ð  ˆLÜ(-¯©Ð%Ø" j§o¡oÑ5Ø)Ÿ™Ð/BÑC×GÑGØ-¨tó �ð  Ð+Ù#/£>�LØ0<×0BÑ0BÐ-ð +Ð.GÑGò =Ø-´·±Ñ<ð ñ Ø#Ð/Ð/Ð/ä 1Ø ¨e°]ÀEó!�ð %Ð$à!Ð!Ü˜
¤T¬5 MÔ2ð
 #-ö	ð ñ 7Ø  }°eõðˆGð ô ˜*¤dÔ+Ø�ä˜W“~Ð%Ü˜
¤DÔ)ØˆLØ(×.Ñ.Ó0ò ‘
��7Ù"HØ˜U M°5ó#�˜Q’ðð  ÐØÐØäØ3°Zóð ùò)s   ÃD;N)	r)   r†   ÚnnÚModuler^  rŽ   r'   r]   r£   )	r[  rô   rY   rõ   ra   rb   Úold_argrG  rh  s	       ``  @rT   Ú+_maybe_insert_observers_before_graph_outputrl  ƒ  s›   ú€ ðIÜðIä�x‰x�‰ðIô œC¤§¡§¡Ð0Ñ1ðIô ð	Iô
 
÷IðZ )×-Ñ-öàñ 	/¨w¸¸}ÈeÕTð€Hð ô
 # 8›_ÐÕùòs   Á-BrX  Ú&node_name_to_match_result_with_qconfigc                 ó  — d| j                   d   d<   d| j                   d   d<   |j                  | j                  d«      \  }}}}}|�?|j                  «       r.| j                  d   }t        |t        «      rt        |||«       yyyy)zÛ
    Assigns `target_dtype` to `node`, setting `is_dynamic` to False. If `node`
    is a general tensor shape op, also call this function recursively on
    the first argument, to propagate the dtype to the caller.
    Nrž   rL   rM   ©NNNNNr   )r¥   r^   rñ   r  r]   rn   r(   Ú_maybe_propagate_dtype_for_node)	r‰   rX  rm  Ú
_root_noder³   Ú_patternr  Ú_qconfigÚ	prev_nodes	            rT   rp  rp  ä  s¦   € ð AE€D‡I�IÐ!Ñ"Ð#<Ñ=ØAE€D‡I�IÐ!Ñ"Ð#=Ñ>ð 	/×2Ñ2Ø�	‰	Ð1ó	ñØØ	ØØØð
 Ð × CÑ CÔ EØ—I‘I˜a‘Lˆ	Ü�i¤Ô&Ü+Ø˜<Ð)Oõð 'ð !FÐrV   c           	      ó\  — | j                   D ]�  }t        |«      }|D ]‹  } ||   |«      }|D ]y  }|j                  |   }t        |t        t
        f«      rt        |«      }n|g}|D ]>  }	t        |	t        j                  j                  j                  «      sŒ2t        |	||«       Œ@ Œ{ Œ� ŒŸ y)a  
    Currently we assume that inputs to the graph are either `torch.float` or
    `torch.quint8`, which is not always correct. For ops such as
    `x.masked_fill(mask, value)`, we know that the dtype of  `mask` is a
    `BoolTensor`. Propagate this information throughout the graph.

    Note: not all dtypes in the graph will be correct after this pass, but a
    higher percentage of them will be correct. Hopefully in the future we can
    replace this with a better way to reason about dtypes of tensors.
    N)ÚnodesrA   r]   rn   r£   r¢   r†   rŒ   r‰   r(   rp  )
rõ   rm  r‰   Únon_observable_arg_dictÚarg_typeÚnon_observable_indicesÚindexrW   Úarg_listÚcur_args
             rT   rH   rH     s¸   € ð —‘ò ˆÜ"JÈ4Ó"PÐà/ò 	ˆHØ%FÐ%<¸XÑ%FÀtÓ%LÐ"à/ò �Ø—i‘i Ñ&�ô ˜c¤E¬4 =Ô1Ü# C›y‘Hà #˜u�Hà'ò �Gä! '¬5¯8©8¯=©=×+=Ñ+=Õ>Ü7Ø# XÐ/Uõñññ	ñrV   c                 óÒ  — d}t        t        | j                  «      «      D ];  }t        | j                  |   t        t
        t        f«      sŒ,| j                  |   } n |€yt        |t
        t        f«      r|d   }nt        |t        «      r|}nyd}t        ||«      sŽt        |t        «      sy|j                  dk(  ryd}t        t        |j                  «      «      D ]#  }|j                  |   }t        |t        «      sŒ# n |€y|}|dz  }|dkD  rt        d«      ‚t        ||«      sŒŽt        |t        «      sJ ‚|j                  }t        |t        «      sJ ‚||   }	t        |t
        t        f«      ršt        |«      D ]Œ  \  }
}|
dk(  rŒd}t        ||«      sKt        |j                  «      dk  r y|j                  d   }|dz  }|dkD  rt        d«      ‚t        ||«      sŒKt        |j                  «      \  }}t        ||   ||	«       ŒŽ | j                  j!                  «       D ]8  }t        ||«      sJ ‚t        |j                  «      \  }}t        ||   ||	«       Œ: y)	aª  
    Ensures that we share an observer
    for all input arguments as well as the output argument. In detail, given
    a graph of

      x0 -> obs0 -> op -> x2
                  /
      x1 -> obs1 /

    where node obs0 points to observer instance observer0,
    obs1 points to observer1 and obs2 points to observer2, we make nodes obs1
    and ob2 point to observer0.
    Returns: whether the operation succeeded or not
    NFr   rÅ   r*   i'  z(Unable to find observer of previous nodeT)ÚrangerÇ   r]   rn   r(   r¢   r£   r\   r�   ÚAssertionErrorr�   rŽ   r0  r!   rú   r1  rp   )r‰   rô   rY   Ú	first_argÚiÚfirst_arg_argÚiteration_guardÚtrace_back_nodeÚtarget_to_useÚobs_mod_to_useÚ	input_idxÚ	input_argÚparent_namerñ   Úoutput_obs_nodes                  rT   Ú(_maybe_make_input_output_share_observersr‹  )  sr  € ð& €Iä”3�t—y‘y“>Ó"ò ˆÜ�d—i‘i ‘l¤T¬4´Ð$7Õ8ØŸ	™	 !™ˆIÙðð ÐØä�)œd¤E˜]Ô+Ø! !™‰Ü	�IœtÔ	$Ø!‰àð
 €OÜ.¨}¸mÔLÜ˜-¬Ô.Øà×Ñ˜}Ò,ØàˆÜ”s˜=×-Ñ-Ó.Ó/ò 	ˆAØ+×0Ñ0°Ñ3ˆOÜ˜/¬4Õ0Ùð	ð Ð"ØØ'ˆà˜1ÑˆØ˜UÒ"Ü Ð!KÓLÐLô% /¨}¸mÕLô( �m¤TÔ*Ð*Ð*Ø!×(Ñ(€MÜ�m¤SÔ)Ð)Ð)Ø" =Ñ1€Nä�)œd¤E˜]Ô+ä$-¨iÓ$8ò 	FÑ ˆI�yØ˜AŠ~ØØˆOÜ6°yÀ-ÔPä�y—~‘~Ó&¨Ò*Ù Ø%ŸN™N¨1Ñ-�	Ø 1Ñ$�Ø" UÒ*Ü(Ð)SÓTÐTô 7°yÀ-ÕPô !-¨Y×-=Ñ-=Ó >ÑˆK˜Ü�M +Ñ.°°nÕEð	Fð"  Ÿ:™:Ÿ?™?Ó,ò BˆÜ/°ÀÔOÐOÐOÜ(¨×)?Ñ)?Ó@Ñˆ�TÜ�˜kÑ*¨D°.ÕAðBð rV   c                 óÒ   — t        | j                  j                  «       «      }|D ]?  \  }}t        ||«      sJ ‚|j	                  | «       |j
                  j                  |«       ŒA y rP   )r¢   r1  rF  r\   Úreplace_all_uses_withrõ   Ú
erase_node)r‰   rô   rY   rF  rŠ  r³   s         rT   Ú_remove_output_observerr�  ‡  s_   € ô �—‘×!Ñ!Ó#Ó$€EØ#ò 0Ñˆ˜Ü/°ÀÔOÐOÐOØ×-Ñ-¨dÔ3Ø�‰×Ñ˜Õ/ñ0rV   c                 óÆ   — || j                      }|j                  }t        |||«      }|j                  |«      }t	        | j                   «      \  }}	t        ||   |	|«       y rP   )r�   Úfloat_to_observed_mappingr#   Ú
from_floatr!   rú   )
r‰   r•   rY   rÙ   Úcustom_moduleÚcustom_module_class_mappingÚobserved_custom_module_classÚobserved_custom_moduler‰  rñ   s
             rT   Ú_swap_custom_module_to_observedr—  ‘  si   € ð " $§+¡+Ñ.€MØ"7×"QÑ"QÐÜ#BØÐ2°Gó$Ð ð :×DÑDÀ]ÓSÐÜ$ T§[¡[Ó1Ñ€K�ÜˆM˜+Ñ&¨Ð.DÕErV   Únode_name_to_qconfigÚequalization_config_mapÚobserved_node_namesc                 óð  — i }t        | j                  d¬«      «      }	|j                  }
|j                  }t	        «       }| j
                  j                  D ](  }t        j                  t        «      |j                  d<   Œ* d}d}i }i }| j
                  j                  D ]5  }|j                  dk(  r
|||<   |dz  }|j                  dk(  sŒ,|||<   |dz  }Œ7 |j                  «       D ]   }|\  }}}}}|€J ‚t        ||||||	||«       Œ" | j
                  j                  D ]®  }|j                  dk(  r.||   |
v r't        j                  t        «      |j                  d<   Œ@|j                  d	v r#t        ||	|«      }|sŒ^ddd
œ|j                  d<   Œq|j                  dk(  sŒ�||   |v sŒ‰t        j                  t        «      |j                  d<   Œ° t        | j
                  |«       t	        «       }|j                  «       D ]§  }|\  }}}}}t!        ||||«      }|€J ‚j                  d   d   }|r |«       nd}t#        |«      \  }}|rŒK|dt$        t&        t(        j*                  fvsŒjt        ||t(        j,                  j.                  j0                  j2                  d||	||«       Œ© t5        | j
                  j                  «      }t	        «       }d}d}d} i }!|D �]  }|j                  dk(  r�nÒ|j                  dv �rÃ|j7                  |j8                  d«      \  }}}}}|j7                  |j8                  d«      }"|j                  d   }#d|j                  v r$|#duxr t;        |j                  d   t<        «      }$n|#du}$|du xs |$ xr |j                  dk(   }%t!        ||||«      }|%�s|�rt        | j                  d¬«      «      }	|j                  dk7  �rÌ|€J ‚t?        ||«       d}&tA        |jB                  «      dkD  rÂt;        |jB                  d   tD        «      r¥tA        |jB                  d   jF                  «      dkD  r€|jB                  d   jF                  D ]d  }'|j7                  |'j8                  d«      duxs7 |'j                  dk(  xr& t;        |	tI        |'jJ                  «         tL        «      }(|'|k7  sŒ`|(sŒcd}&Œf tO        |«      })|)j7                  |tP        «      }* |*|«      }+||+u },|,r8tS        ||| |	| j
                  |||!||«
       tU        ||"| |	| j
                  |&«       ||u }-|j                  d   j7                  dd«      }.|j                  d   j7                  dd«      }/|-�rNtW        ||	||«      rQtY        || |	| j
                  «       |jJ                  |v�r|j[                  |jJ                  «       t]        |||	|«       nït_        || |	| j
                  |!|«      }0|0�Ót5        |jF                  ja                  «       «      }1|1D ]  }2|2|0u rŒ|2jc                  ||0«       Œ te        ||	|!|«      }3|.r|3s|/rtg        || |	«      sti        || |	«       |�b|jk                  «       rR|jJ                  |vrD|j[                  |jJ                  «       t]        |||	|«       ntm        || |	| j
                  |!|«       |j                  dk(  r|dz  }�Œý|j                  dk(  s�Œ|dz  }|} �Œ | S )a$  
    Inserts observers, using the following high level algorithm:

    For each node in the graph:
      1. determine the target dtype of this node in the quantized graph, and save
           it for future steps
      2. determine the target dtype or all args and kwargs of this node
      3. if any arg or kwarg's target dtype does not match the current node's
           dtype, insert an observer
      4. if the current node needs an output observer, insert it

    For example:

    - starting graph:
        x0 -> linear -> x1

    - observed graph after processing x0:
        x0(fp32)

    - observed graph after processing linear:
        x0(fp32) -> x0_obs0(int8) -> linear(int8) -> linear_obs0(int8)

    - observed graph after processing x1:
        x0(fp32) -> x0_obs0(int8) -> linear(int8) -> linear_obs0(int8) -> x1

    After a node is processed, the naive observer placement is guaranteed to be
    complete for that node and all of its predecessors. There can be future
    passes which optimize the graph by deduplicating observers, etc.
    F©Úremove_duplicaterž   r   rÅ   r*   rW  N)r‹   Úcall_methodr  rK   rM   )r‹   rž  r  rW  ro  Úvalr‹   Tr  r�   )7r^  rY   r/  Úoutput_quantized_indexesÚsetrõ   rv  rQ   r  r¥   r�   rÏ   r  Ú-_DEFAULT_QUINT8_QCONFIG_FOR_TARGET_DTYPE_INFOr=   rH   rØ   r”   Úintr‡   r†   r§   ÚaoÚquantizationr•   Ú!_default_fp32_placeholder_qconfigr¢   r^   rñ   rn   r   rò   rÇ   r]   r(   r1  rŽ   r�   r   r   r6   rK  rU  r:   r9   rð   r—  rZ  rp   Úreplace_input_withrË   r‹  r�  Úis_custom_modulerl  )4rô   rm  r˜  rÙ   r™  r—   rš  rb   r  rY   Úinput_quantized_idxsÚoutput_quantized_idxsr  r‰   Úinputs_seen_counterÚoutputs_seen_counterÚplaceholder_node_to_input_indexÚoutput_node_to_output_indexÚmatch_res_with_qconfigr  rÍ   rÌ   r  r•   r  Úis_supported_by_backendÚoutput_act_or_fq_ctrÚoutput_act_or_fqÚoutput_act_dtyper³   Únodes_before_observationÚ#custom_module_names_already_swappedÚresults_nodera   rL  Úthis_node_dtype_infoÚoutput_is_a_tensorÚskip_inserting_observersÚis_quantized_branchÚuserÚis_user_quantizedrÒ   rÓ   rÔ   Úis_input_node_of_the_patternÚis_last_node_of_patternr  r�   Úmaybe_output_obs_nodeÚ
orig_usersÚ	user_nodeÚ_is_observer_in_same_graph_s4                                                       rT   rF   rF   ¡  s%  € ðx 35Ðô ˜×,Ñ,¸eÐ,ÓDÓE€Mà&;×&SÑ&SÐØ'<×'UÑ'UÐÜ!$£€Oà—‘×!Ñ!ò 
ˆÜ)-¯©Ü7ó*
ˆ�	‰	Ð%Ò&ð
ð
 ÐØÐØ79Ð#ð 46ÐØ—‘×!Ñ!ò &ˆØ�7‰7�mÒ#Ø4GÐ+¨DÑ1Ø 1Ñ$ÐØ�7‰7�hÓØ0DÐ'¨Ñ-Ø  AÑ%Ñ ð&ð #I×"OÑ"OÓ"Qò 
Ðð #ñ	
ØØ ØØØàÐ#Ð#Ð#Ü7Ø ØØØØØØ%Øõ		
ð
ð2 —‘×!Ñ!ò !ˆà�G‰G�}Ò$Ø/°Ñ5Ð9MÑMô .2¯Y©YÜ=ó.ˆD�I‰IÐ)Ò*ð �W‰WÐGÑGÜ#@Ø�mÐ%>ó$Ð ò $à/3Ø04ñ2�—	‘	Ð-Ò.ð
 �G‰G�xÓØ+¨DÑ1Ð5JÒJô .2¯Y©YÜ=ó.ˆD�I‰IÐ)Ò*ð?!ôN %Ø�‰Ð;ôô "%£€OØ"H×"OÑ"OÓ"Qò 'Ðð #ñ	
ØØ ØØØô FØÐ-¨w¸óð 	 ð
 Ð#Ð#Ð#ð
  $Ÿy™yÐ)<Ñ=Ø&ñ 
Ðñ 6JÑ/Ô1ÈtÐÜ7Ð8HÓIÑÐ˜!Ú&Ð+;ØÜÜÜ�J‰Jð	D
ò ,
ô <Ø$ØÜ—‘×%Ñ%×-Ñ-×OÑOØØØØ)Øõ	ð='ô`  $ E§K¡K×$5Ñ$5Ó6Ðô 58³EÐ'ð ÐØÐØ€LØ>@€Mð )ó h ˆØ�7‰7�mÒ#ñ à�W‰WÐQÒQð 7×:Ñ:Ø—	‘	Ð9óñØØ$ØØØð $;×#>Ñ#>¸t¿y¹yÈ$Ó#OÐ à#'§9¡9Ð-@Ñ#AÐ Ø˜Ÿ	™	Ñ!Ø%9ÀÐ%Eò &Ì*Ø—I‘I˜eÑ$¤jóKÑ"ð &:ÀÐ%EÐ"ð ˜D�Ò;Ð);Ð%;ò(,à—w‘w (Ñ*Ð*ð %ô JØÐ1°7¸Nóð $ò ,Ò0GÜ $ U×%8Ñ%8È%Ð%8Ó%PÓ Q�Ø—7‘7˜hÓ&Ø/Ð;Ð;Ð;ä1Ø,Ð.Aôð +0Ð'ä˜DŸI™I›¨Ò*Ü& t§y¡y°¡|´TÔ:Ü §	¡	¨!¡× 2Ñ 2Ó3°aÒ7à$(§I¡I¨a¡L×$6Ñ$6ò ;˜Dà0D×0HÑ0HØ $§	¡	¨4ó1à%)ð1*ò 1ð !%§¡¨=Ñ 8ò !"Ü$.Ø$1´#°d·k±kÓ2BÑ$CÄ\ó%"ð	 .ð  $ t›|Ò0AØ6:Ñ 3ð;ô ?¸~ÓNð 0ð (C×'FÑ'FØÔ!:ó(Ð$ñ !1Ð1EÓ F�IØ37¸9Ð3DÐ0Ù3ä>Ø Ø#Ø!Ø)Ø!ŸK™KØ$Ø1Ø)Ø"Ø*ôô LØ Ø0Ø!Ø)Ø!ŸK™KØ/ôð /3°iÐ.?Ð+Ø37·9±9Ð=PÑ3Q×3UÑ3UØ6¸ó4Ð0ð -1¯I©IÐ6IÑ,J×,NÑ,NØ/°ó-Ð)ò /Ü1Ø  -°¸(ôô PØ $ e¨]¸E¿K¹Kôð  $Ÿ{™{Ð2UÒUØ C× GÑ GÈÏÉÔ TÜ ?Ø$(¨'°=ÐBWõ!"ô !GØ$(Ø$)Ø$1Ø$)§K¡KØ$1Ø$*ó!"ð 2ð  5Ð@ô  .2°$·*±*·/±/Ó2CÓ-D 
Ø1;ò !& IØ'0Ð4IÑ'IØ(0Ø$-×$@Ñ$@Ø(,Ð.Cõ%&ð!&ô %?Ø(,¨m¸]ÈFó%&ð !<ñ %AÙ(CÙ%:Ü+SØ(,¨e°]ô,&ô )@Ø,0°%¸ô)*ð $,Ð#7¸H×<UÑ<UÔ<Wà(,¯©Ø/Rñ)Sð )L×(OÑ(OØ,0¯K©Kô)*ô )HØ,0Ø,3Ø,9Ø,Aõ	)*ô @Ø˜e ]°E·K±KÀÐPVôð �7‰7�mÒ#Ø 1Ñ$ÒØ�W‰W˜Ô Ø  AÑ%Ð ØŠLðQh ðT ÐrV   c           	      óŽ  — |j                  «       D ]²  \  }}}}	}
|	€Œ|	j                  «       sŒt        ||||
|«      \  }}}}||j                     }t        j
                  j                  j                  j                  } |||||||¬«      }t        |j                  «      \  }}t        ||   ||«       |||j                  <   Œ´ y)z¨
    Runs prepare_fx on each standalone module. Note: this does
    not modify the graph, it just replaces the unobserved modules with
    their observed versions.
    N)râ   rÙ   r—   )rÏ   r  ræ   r�   r†   r¤  r¥  Úquantize_fxÚ_prepare_standalone_module_fxr!   rú   )rô   rb   rY   rm  rÙ   r—   rÔ   r³   rr  r  r•   Úsm_qconfig_mappingÚsm_example_inputsr;  Úsm_backend_configÚstandalone_modulerG   Úobserved_standalone_moduler‰  rñ   s                       rT   Ú%_run_prepare_fx_on_standalone_modulesrË  r  sù   € ð& 
0×	6Ñ	6Ó	8ò#Eñ 	ØØ	ØØØàÐØØ×.Ñ.Ô0Øô +Ø�}Ð&;¸WÀnó
ñ	
ØØØ$Øð
 *¨)×*:Ñ*:Ñ;Ðä�H‰H×!Ñ!×-Ñ-×KÑKð 	ñ &-ØØØØ,Ø":Ø,ô&
Ð"ô )¨×)9Ñ)9Ó:Ñˆ�TÜ�˜kÑ*¨DÐ2LÔMØ*Dˆ�i×&Ñ&Ò'ñG#ErV   ÚobservedÚnode_name_to_scopeÚ!equalization_node_name_to_qconfigrà   c           	      óB   — t        |||||||¬«      | j                  d<   y )N)r˜  rÍ  rÙ   rÎ  rà   rb   rš  Ú_observed_graph_module_attrs)rE   r¥   )rÌ  r˜  rÍ  rÙ   rÎ  rà   rb   rš  s           rT   Ú_save_staterÑ  ¥  s.   € ô 5MØ1Ø-Ø3Ø*KØ'ØØ/ô5€H‡M�MÐ0Ò1rV   râ   Ú_equalization_configr  c	           
      óJ  — |€
t        «       }|€
t        «       }t        |t        «      r1t	        j
                  dt        d¬«       t        j                  |«      }t        |t        «      r1t	        j
                  dt        d¬«       t        j                  |«      }t        |t        «      r1t	        j
                  dt        d¬«       t        j                  |«      }t        |t        «      r1t	        j
                  dt        d¬«       t        j                  |«      }t        |t        «      sJ ‚t        |t        «      sJ ‚t        j                  |«      }t        j                  |«      }i }	|€
t        «       }t        |«      }	t        |	«      }	t        |«      }
t        | |«       t        | |«       t!        |«      }t#        | ||j%                  «       «       |r#t'        |«      }t)        | |«       t+        ||«       t        | j-                  d¬«      «      }t/        | || j0                  ||«      }t/        | || j0                  ||«      }t3        |j4                  j7                  «       «      }t3        |j8                  j7                  «       «      }t;        |j<                  «      }t?        | j0                  ||	|
|||«      }i }|jA                  «       D ]  \  }}g |¢||   ‘­}|||<   Œ tC        | |||||«       tE        «       }tG        | |||||||«      }tI        | | j0                  «      } tK        | |||||||«       |rd|€J ‚t        |jL                  d	   tN        «      sJ d
«       ‚|jP                  }|jR                  }| jT                  d   }d|_+        ||_,        ||_-        | S )a9  standalone_module means it a submodule that is not inlined in
    parent module, and will be quantized separately as one unit.

    How the standalone module is observed is specified by `input_quantized_idxs` and
    `output_quantized_idxs` in the prepare_custom_config for the standalone module
    Args:
        node_name_to_scope: mapping from node name to the scope of the module which contains the node.
        The scope is a tuple of fully qualified path of the module and the type of the module
    Returns:
        model(GraphModule): prepared standalone module
        attributes related to standalone module
        in model.meta["_observed_graph_module_attrs"]:
            is_observed_standalone_module (bool): boolean value that shows whether the
            current model is a observed standalone module or not
            standalone_module_input_quantized_idxs(List[Int]): a list of
                indexes for the graph input that is expected to be quantized,
                same as input_quantized_idxs configuration provided
                for the standalone module
            standalone_module_output_quantized_idxs(List[Int]): a list of
                indexs for the graph output that is quantized
                same as input_quantized_idxs configuration provided
                for the standalone module
    z�Passing a QConfig dictionary to prepare is deprecated and will not be supported in a future version. Please pass in a QConfigMapping instead.é   )Ú
stacklevelzžPassing a QConfig dictionary to prepare for equalization is deprecated and will not be supported in a future version. Please pass in a QConfigMapping instead.zšPassing a prepare_custom_config_dict to prepare is deprecated and will not be supported in a future version. Please pass in a PrepareCustomConfig instead.z�Passing a backend_config_dict to prepare is deprecated and will not be supported in a future version. Please pass in a BackendConfig instead.Frœ  r   zVstandalone module only supports returning simple value currently(not tuple, dict etc.)rÐ  T).r-   r   rn   r^  rO  rP  ÚFutureWarningÚ	from_dictr   rQ   rR   r   r7   r1   r   r4   r3   r   Úto_dictr   rí   r5   rY   r2   rõ   r¢   rß   rp   rÞ   r?   r‘  r/   rF  rË  r¡  rF   r&   rÑ  r]   r(   r/  r   r¥   Úis_observed_standalone_moduleÚ&standalone_module_input_quantized_idxsÚ'standalone_module_output_quantized_idxs)rô   rà   rb   rÍ  râ   rÙ   rÒ  r—   r  Úpattern_to_quantize_handlerÚroot_node_getter_mappingÚflattened_qconfig_dictrè   rY   rÎ  r˜  rß   rÞ   Úcustom_module_classesÚmatches_without_qconfigrm  Ú	node_nameÚmatch_without_qconfigÚmatch_with_qconfigrš  Úresult_noder©  rª  Úobserved_graph_module_attrss                                rT   rG   rG   º  sí  € ðD Ð$Ü 3Ó 5ÐØÐ#Ü-Ó/Ðä�/¤4Ô(Ü�‰ðLäØõ		
ô )×2Ñ2°?ÓCˆäÐ&¬Ô-Ü�‰ðYäØõ		
ô  .×7Ñ7Ð8LÓMÐäÐ'¬Ô.Ü�‰ðQäØõ		
ô !4× =Ñ =Ð>SÓ TÐä�.¤$Ô'Ü�‰ðKäØõ		
ô '×0Ñ0°Ó@ˆä�o¤~Ô6Ð6Ð6ÜÐ*¬NÔ;Ð;Ð;Ü—m‘m OÓ4€OÜŸ=™=Ð)=Ó>Ðð CEÐØÐÜ2Ó4ˆÜ"CÀNÓ"SÐÜ"7Ð8SÓ"TÐäEÀnÓUÐä˜u oÔ6Ü˜uÐ&:Ô;Ü8¸ÓIÐä�uÐ4Ð6K×6SÑ6SÓ6UÔVáÜ7¸ÓGÐÜ˜%Ð!5Ô6Ü °Ô@ô ˜×,Ñ,¸eÐ,ÓDÓE€Mô )GØˆ}˜eŸk™kÐ+?ÐASó)Ð%ô :Øˆ}˜eŸk™k¨?Ð<NóÐô
 #Ð#8×#PÑ#P×#UÑ#UÓ#WÓXÐÜ $Ø×7Ñ7×<Ñ<Ó>ó!Ðô 9Ø×7Ñ7óÐô ,Ø�‰ØØ#Ø ØØ!ØóÐð .0Ð*Ø,C×,IÑ,IÓ,Kò OÑ(ˆ	Ð(ØVÐ4ÐVÐ6JÈ9Ñ6UÑVÐØ<NÐ.¨yÒ9ðOô *ØØØØ.ØØôô %(£EÐä,ØØ.ØØØ)ØØØó	€Kô ˜˜uŸ{™{Ó+€EäØØØØØ)ØØØô	ñ ØÐ&Ð&Ð&Ü˜+×*Ñ*¨1Ñ-¬tÔ4ð 	
ð%ó	
Ð4ð +@×*WÑ*WÐð "×:Ñ:ð 	ð ',§j¡jÐ1OÑ&PÐ#àDHÐ#ÔAà ð 	$ÔJð "ð 	$ÔKð €LrV   )FrP   )NNNF)ŸrQ   rO  Údataclassesr   Útypingr   r   r   r†   Útorch._subclassesr   Útorch.ao.quantizationr   r	   r
   r   r   r   Ú$torch.ao.quantization.backend_configr   r   r   Ú*torch.ao.quantization.backend_config.utilsr   r   r   Útorch.ao.quantization.observerr   r   Útorch.ao.quantization.qconfigr   r   Ú%torch.ao.quantization.qconfig_mappingr   Útorch.ao.quantization.quantizer   r   Útorch.ao.quantization.quantizerr   r   r   r   r   r    Útorch.ao.quantization.utilsr!   r"   r#   r$   r%   Útorch.fxr&   Útorch.fx.graphr'   r(   Útorch.fx.noder)   Ú	_equalizer+   r,   Úcustom_configr-   r.   Úmatch_utilsr/   r0   Úpattern_utilsr1   Úqconfig_mapping_utilsr2   r3   r4   r5   Úquantize_handlerr6   r7   r8   Úutilsr9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   Ú__all__r£  r‡   r§   r…   rÈ   Úqint8Úqint32r  rÉ   Úint8Úint16Úint32Úfloat8_e5m2Úfloat8_e4m3fnr„   rr   r¼   r¤  r¥  r•   r¦  r  r  Ú#_default_quint8_placeholder_qconfigr¢  rU   r^  rŽ   ri  rj  r_   r|   rˆ   r\   r£   rJ   r”   rš   rÃ   rË   r¢   rØ   ræ   rÝ   rí   r¡  rò   r  r  r	  r"  rÆ   r*  r,  rK  rU  rZ  rl  rp  rH   r‹  r�  r—  rF   rË  rÑ  rG   rm   rV   rT   ú<module>r     ss  ðã Û Ý ß 'Ñ 'ã Ý (÷÷ ÷ñ ÷
ñ ÷
 Xß MÝ @ß F÷÷ ÷õ õ !ß &Ý "ç Kß Kß ?Ý 0÷ó ÷ñ ÷
÷ ÷ õ ò"€ð ˜u e§j¡j°$Ð7Ð à	‡L�LØ	‡K�KØ	‡L�LØ	‡M�MØ	‡K�KØ	‡J�JØ	‡K�KØ	‡K�KØ	×ÑØ	×Ñð€ð <Ð1×;Ñ;À%Ç+Á+ÔNÐ ð
  %Ÿx™x×4Ñ4×<Ñ<×^Ñ^×iÑiØ %§¡× 5Ñ 5× =Ñ =× _Ñ _× jÑ jñ/Ð +ð  %Ÿx™x×4Ñ4×<Ñ<×`Ñ`×kÑkØ %§¡× 5Ñ 5× =Ñ =× aÑ a× lÑ lñ1Ð -ð&ØÐ&Ð(DÐDÑEó&ð*Ø	ð*à˜$Ð 4Ð4Ñ5ð*ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð*ð Ð"Ñ#ó	*ð6<ØÐ 4Ñ5ð6<à˜
Ð$:Ð:Ñ;ð6<ð ó6<ð~  ñ&Øð&à ð&ð ð&ð  ð	&ð
  ð&ð ð&ð 
ó&ðRØ
ðØ# C¨¯©¯©Ð$8Ñ9ðà	óð
HØÐ.Ñ/ð
Hà
ˆ8�E—K‘KÑ  $Ð&Ñ'ó
HðD
Ø	ðD
à
ðD
ð ðD
ð ð	D
ð
 "ðD
ð 
óD
ðN"Ø
ð"àð"ð ð"ð 
ó	"ðJØ
ðà˜˜UŸX™XŸ_™_Ð,Ñ-ðð ˜
Ð$:Ð:Ñ;óð.$Ø�gÑð$à" 4¨¡:Ñ.ð$ð ð$ð "ð	$ð
 
ó$ðNTØ
ðTà˜˜UŸX™XŸ_™_Ð,Ñ-ðTð /ðTð ð	Tð
 $ MÑ2ðTð Ø�E˜#˜s˜(‘OÐ%8¸(À=Ñ:QÐQñóTðDTØ
�(‰(�/‰/ðTØ15°g¸tÀEÇHÁHÇOÁOÑ?TÐ6TÑ1UðTà	óTð9¸ð 9ÈÈCÉó 9ðØ
ðà%ðð �8‰8�?‰?ðð ˜˜UŸX™XŸ_™_Ð,Ñ-ð	ð
 ðð 
óð<4;Ø%ð4;àð4;ð ð4;ð �Ñ'ð	4;ð
 "ð4;ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð4;ð  $ D¨$ JÑ/ð4;ð ˜‘Yð4;ð 
ó4;ðnbBØ
ðbBàðbBð �Ñ'ðbBð ˜˜UŸX™XŸ_™_Ð,Ñ-ð	bBð
 "ðbBð  $ D¨$ JÑ/ðbBð 
ˆ#ˆsˆ(�^óbBðJA Ø	ðA à˜˜UŸX™XŸ_™_Ð,Ñ-ðA ð ˜
Ð$:Ð:Ñ;ðA ð ð	A ð
 Ð$Ñ%óA ðH&Ø	ð&à˜˜UŸX™XŸ_™_Ð,Ñ-ð&ð ˜
Ð$:Ð:Ñ;ð&ð ð	&ð
 ˆe�k‰kÑó&ð16Ø	ð16à
ð16ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð16ð ˜
Ð$:Ð:Ñ;ð	16ð
 ð16ð Ð$Ñ%ó16ð~ /3ñ`Ø
��c�	Ñ
ð`à	ð`ð ð`ð �8‰8�?‰?ð	`ð
 ˜˜UŸX™XŸ_™_Ð,Ñ-ð`ð ð`ð �Ñ'ð`ð /ð`ð ˜
Ð$:Ð:Ñ;ð`ð ð`ð ˜]Ñ+ð`ð ó`ðZ /3ñ@Ø
ð@àð@ð �8‰8�?‰?ð@ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð	@ð
 ð@ð �Ñ'ð@ð /ð@ð ˜
Ð$:Ð:Ñ;ð@ð ð@ð ˜]Ñ+ð@ð 
ó@ðF- Ø
ð- àð- ð �8‰8�?‰?ð- ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð	- ð
 ð- ð ð- ð 
ó- ð`NØ
ðNà�8‰8�?‰?ðNð ˜˜UŸX™XŸ_™_Ð,Ñ-ðNð ð	Nð
 ˜
Ð$:Ð:Ñ;ðNð ðNð ˆd�^óNðb^-Øð^-à�8‰8�?‰?ð^-ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð^-ð ð	^-ð
 ˜
Ð$:Ð:Ñ;ð^-ð ð^-ð 
ó^-ðBØ
ðà˜Ÿ™ TÐ)Ñ*ðð -1°Ð6MÐ1MÑ,Nðð 
ó	ð>#Øð#à,0°Ð6MÐ1MÑ,Nð#ð 
ó#ðL[Ø
ð[à�8‰8�?‰?ð[ð ˜˜UŸX™XŸ_™_Ð,Ñ-ð[ð 
ó	[ð|0Ø
ð0Ø—x‘x—‘ð0Ø7;¸CÀÇÁÇÁÐ<PÑ7Qó0ðFØ
ðFàðFð ˜˜UŸX™XŸ_™_Ð,Ñ-ðFð /ó	Fð NØðNà,0°Ð6MÐ1MÑ,NðNð ˜s J˜Ñ/ðNð /ð	Nð
 " # s (™^ðNð "ðNð ˜S™ðNð ðNð ˆd�^óNðb0EØ�8‰8�?‰?ð0Eàð0Eð ˜˜UŸX™XŸ_™_Ð,Ñ-ð0Eð -0ð	0Eð
 /ð0Eð "ð0Eð 
ó0EðfØðà˜s J˜Ñ/ðð ˜S %¨¨T¨	Ñ"2Ð2Ñ3ðð /ð	ð
 (,¨C°¨H¡~ðð $ðð ðð ˜S™ðð 
óð6 OSØHLØAEØ!&ñSØðSà˜>¨4°°S°©>Ð9Ñ:ðSð ðSð ˜S %¨¨T¨	Ñ"2Ð2Ñ3ð	Sð
 ˜#˜s˜(‘OðSð !Ð!4°d¸3À¸8±nÀdÐ!JÑKðSð   °°S¸#°X±ÀÐ DÑEðSð ˜-¨¨c°3¨h©¸Ð=Ñ>ðSð ðSð ôSrV   