ó
    EñiY*  ã                   óœ  • S SK r S SKJr  S SKJrJrJr  S SKrS SKJ	r	  S SK
J	s  Jr  S SKJr  S SKJr  S SKJrJr  SSKJr  S	S
KJrJrJr  S	SKJr  S	SKJrJr  SSKJ r J!r!J"r"  / SQr# " S S\RH                  5      r% " S S\RL                  5      r' " S S\RP                  5      r) " S S\RT                  5      r+ " S S\RX                  5      r- " S S\R\                  5      r/ " S S\R`                  5      r1 " S S\Rd                  5      r3 " S  S!\5      r4\" S"S#9\" S$S% 4S&9SS'S(S).S*\\\4\4      S+\5S,\5S-\S.\34
S/ jj5       5       r6g)0é    N)Úpartial)ÚAnyÚOptionalÚUnion)ÚTensor)Ú	inception)ÚInception_V3_WeightsÚInceptionOutputsé   )ÚImageClassificationé   )Úregister_modelÚWeightsÚWeightsEnum)Ú_IMAGENET_CATEGORIES)Ú_ovewrite_named_paramÚhandle_legacy_interfaceé   )Ú_fuse_modulesÚ_replace_reluÚquantize_model)ÚQuantizableInception3ÚInception_V3_QuantizedWeightsÚinception_v3c                   óf   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrSS	\\	   SS4S
 jjr
SrU =r$ )ÚQuantizableBasicConv2dé   ÚargsÚkwargsÚreturnNc                 óZ   >• [         TU ]  " U0 UD6  [        R                  " 5       U l        g ©N)ÚsuperÚ__init__ÚnnÚReLUÚrelu©Úselfr   r   Ú	__class__s      €Úf/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/models/quantization/inception.pyr$   ÚQuantizableBasicConv2d.__init__   s"   ø€ Ü‰Ò˜$Ð) &Ò)Ü—G’G“Iˆ�	ó    Úxc                 ól   • U R                  U5      nU R                  U5      nU R                  U5      nU$ r"   ©ÚconvÚbnr'   )r)   r.   s     r+   ÚforwardÚQuantizableBasicConv2d.forward   s.   € Ø�I‰I�a‹LˆØ�G‰G�A‹JˆØ�I‰I�a‹LˆØˆr-   Úis_qatc                 ó    • [        U / SQUSS9  g )Nr0   T)Úinplace)r   )r)   r5   s     r+   Ú
fuse_modelÚ!QuantizableBasicConv2d.fuse_model%   s   € Ü�dÒ2°FÀDÓIr-   )r'   r"   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r$   r   r3   r   Úboolr8   Ú__static_attributes__Ú__classcell__©r*   s   @r+   r   r      sP   ø† ð˜cð ¨Sð °T÷ ð˜ð  Fô ñJ ¨$¡ð J¸4÷ Jó Jr-   r   c                   óJ   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrS	rU =r	$ )
ÚQuantizableInceptionAé)   r   r   r    Nc                 óx   >• [         TU ]  " US[        0UD6  [        R                  R                  5       U l        g ©NÚ
conv_block©r#   r$   r   r%   Ú	quantizedÚFloatFunctionalÚmyopr(   s      €r+   r$   ÚQuantizableInceptionA.__init__+   ó/   ø€ Ü‰Ò˜$ÐLÔ+AÐLÀVÒLÜ—L‘L×0Ñ0Ó2ˆ�	r-   r.   c                 ó\   • U R                  U5      nU R                  R                  US5      $ ©Nr   ©Ú_forwardrK   Úcat©r)   r.   Úoutputss      r+   r3   ÚQuantizableInceptionA.forward/   ó%   € Ø—-‘- Ó"ˆØ�y‰y�}‰}˜W aÓ(Ð(r-   ©rK   ©
r:   r;   r<   r=   r   r$   r   r3   r?   r@   rA   s   @r+   rC   rC   )   ó5   ø† ð3˜cð 3¨Sð 3°T÷ 3ð)˜ð ) F÷ )ò )r-   rC   c                   óJ   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrS	rU =r	$ )
ÚQuantizableInceptionBé4   r   r   r    Nc                 óx   >• [         TU ]  " US[        0UD6  [        R                  R                  5       U l        g rF   rH   r(   s      €r+   r$   ÚQuantizableInceptionB.__init__6   rM   r-   r.   c                 ó\   • U R                  U5      nU R                  R                  US5      $ rO   rP   rS   s      r+   r3   ÚQuantizableInceptionB.forward:   rV   r-   rW   rX   rA   s   @r+   r[   r[   4   rY   r-   r[   c                   óJ   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrS	rU =r	$ )
ÚQuantizableInceptionCé?   r   r   r    Nc                 óx   >• [         TU ]  " US[        0UD6  [        R                  R                  5       U l        g rF   rH   r(   s      €r+   r$   ÚQuantizableInceptionC.__init__A   rM   r-   r.   c                 ó\   • U R                  U5      nU R                  R                  US5      $ rO   rP   rS   s      r+   r3   ÚQuantizableInceptionC.forwardE   rV   r-   rW   rX   rA   s   @r+   rb   rb   ?   rY   r-   rb   c                   óJ   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrS	rU =r	$ )
ÚQuantizableInceptionDéJ   r   r   r    Nc                 óx   >• [         TU ]  " US[        0UD6  [        R                  R                  5       U l        g rF   rH   r(   s      €r+   r$   ÚQuantizableInceptionD.__init__L   rM   r-   r.   c                 ó\   • U R                  U5      nU R                  R                  US5      $ rO   rP   rS   s      r+   r3   ÚQuantizableInceptionD.forwardP   rV   r-   rW   rX   rA   s   @r+   ri   ri   J   rY   r-   ri   c                   ób   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\\   4S jrS\S\4S	 jr	S
r
U =r$ )ÚQuantizableInceptionEéU   r   r   r    Nc                 ó  >• [         TU ]  " US[        0UD6  [        R                  R                  5       U l        [        R                  R                  5       U l        [        R                  R                  5       U l        g rF   )	r#   r$   r   r%   rI   rJ   Úmyop1Úmyop2Úmyop3r(   s      €r+   r$   ÚQuantizableInceptionE.__init__W   sW   ø€ Ü‰Ò˜$ÐLÔ+AÐLÀVÒLÜ—\‘\×1Ñ1Ó3ˆŒ
Ü—\‘\×1Ñ1Ó3ˆŒ
Ü—\‘\×1Ñ1Ó3ˆ�
r-   r.   c                 óÞ  • U R                  U5      nU R                  U5      nU R                  U5      U R                  U5      /nU R                  R                  US5      nU R                  U5      nU R                  U5      nU R                  U5      U R                  U5      /nU R                  R                  US5      n[        R                  " USSSS9nU R                  U5      nX#XE/nU$ )Nr   r   )Úkernel_sizeÚstrideÚpadding)Ú	branch1x1Úbranch3x3_1Úbranch3x3_2aÚbranch3x3_2brs   rR   Úbranch3x3dbl_1Úbranch3x3dbl_2Úbranch3x3dbl_3aÚbranch3x3dbl_3brt   ÚFÚ
avg_pool2dÚbranch_pool)r)   r.   r{   Ú	branch3x3Úbranch3x3dblr…   rT   s          r+   rQ   ÚQuantizableInceptionE._forward]   sà   € Ø—N‘N 1Ó%ˆ	à×$Ñ$ QÓ'ˆ	Ø×&Ñ& yÓ1°4×3DÑ3DÀYÓ3OÐPˆ	Ø—J‘J—N‘N 9¨aÓ0ˆ	à×*Ñ*¨1Ó-ˆØ×*Ñ*¨<Ó8ˆà× Ñ  Ó.Ø× Ñ  Ó.ð
ˆð —z‘z—~‘~ l°AÓ6ˆä—l’l 1°!¸AÀqÑIˆØ×&Ñ& {Ó3ˆà¨ÐCˆØˆr-   c                 ó\   • U R                  U5      nU R                  R                  US5      $ rO   )rQ   ru   rR   rS   s      r+   r3   ÚQuantizableInceptionE.forwardr   s%   € Ø—-‘- Ó"ˆØ�z‰z�~‰~˜g qÓ)Ð)r-   )rs   rt   ru   )r:   r;   r<   r=   r   r$   r   ÚlistrQ   r3   r?   r@   rA   s   @r+   rp   rp   U   sL   ø† ð4˜cð 4¨Sð 4°T÷ 4ð˜&ð  T¨&¡\ô ð**˜ð * F÷ *ò *r-   rp   c                   ó8   ^ • \ rS rSrS\S\SS4U 4S jjrSrU =r$ )ÚQuantizableInceptionAuxéw   r   r   r    Nc                 ó2   >• [         TU ]  " US[        0UD6  g rF   )r#   r$   r   r(   s      €r+   r$   Ú QuantizableInceptionAux.__init__y   s   ø€ Ü‰Ò˜$ÐLÔ+AÐLÀVÓLr-   © )r:   r;   r<   r=   r   r$   r?   r@   rA   s   @r+   r�   r�   w   s'   ø† ðM˜cð M¨Sð M°T÷ Mõ Mr-   r�   c                   óf   ^ • \ rS rSrS\S\SS4U 4S jjrS\S\4S jrSS	\	\
   SS4S
 jjrSrU =r$ )r   é}   r   r   r    Nc                 ó$  >• [         TU ]  " US[        [        [        [
        [        [        [        /0UD6  [        R                  R                  R                  5       U l        [        R                  R                  R                  5       U l        g )NÚinception_blocks)r#   r$   r   rC   r[   rb   ri   rp   r�   ÚtorchÚaoÚquantizationÚ	QuantStubÚquantÚDeQuantStubÚdequantr(   s      €r+   r$   ÚQuantizableInception3.__init__~   st   ø€ Ü‰ÒØð	
ô 'Ü%Ü%Ü%Ü%Ü%Ü'ðð	
ð ò	
ô —X‘X×*Ñ*×4Ñ4Ó6ˆŒ
Ü—x‘x×,Ñ,×8Ñ8Ó:ˆ�r-   r.   c                 ó„  • U R                  U5      nU R                  U5      nU R                  U5      u  pU R                  U5      nU R                  =(       a    U R
                  n[        R                  R                  5       (       a(  U(       d  [        R                  " S5        [        X5      $ U R                  X5      $ )NzIScripted QuantizableInception3 always returns QuantizableInception3 Tuple)Ú_transform_inputrš   rQ   rœ   ÚtrainingÚ
aux_logitsr–   ÚjitÚis_scriptingÚwarningsÚwarnr
   Úeager_outputs)r)   r.   ÚauxÚaux_defineds       r+   r3   ÚQuantizableInception3.forward�   s�   € Ø×!Ñ! !Ó$ˆØ�J‰J�q‹MˆØ—‘˜qÓ!‰ˆØ�L‰L˜‹OˆØ—m‘m×7¨¯©ˆÜ�9‰9×!Ñ!×#Ñ#ÞÜ—’ÐiÔjÜ# AÓ+Ð+à×%Ñ% aÓ-Ð-r-   r5   c                 ó|   • U R                  5        H(  n[        U5      [        L d  M  UR                  U5        M*     g)zýFuse conv/bn/relu modules in inception model

Fuse conv+bn+relu/ conv+relu/conv+bn modules to prepare for quantization.
Model is modified in place.  Note that this operation does not change numerics
and the model after modification is in floating point
N)ÚmodulesÚtyper   r8   )r)   r5   Úms      r+   r8   Ú QuantizableInception3.fuse_modelœ   s-   € ð —‘–ˆAÜ�A‹wÔ0Ô0Ø—‘˜VÖ$ò  r-   )rœ   rš   r"   )r:   r;   r<   r=   r   r$   r   r
   r3   r   r>   r8   r?   r@   rA   s   @r+   r   r   }   sM   ø† ð;˜cð ;¨Sð ;°T÷ ;ð".˜ð .Ð$4ô .ñ
% ¨$¡ð 
%¸4÷ 
%ó 
%r-   r   c                   óh   • \ rS rSr\" S\" \SSS9SS\SS	\R                  S
SSS.0SSSS.
S9r
\
rSrg)r   é©   zUhttps://download.pytorch.org/models/quantized/inception_v3_google_fbgemm-a2837893.pthi+  iV  )Ú	crop_sizeÚresize_sizei°rž)éK   r³   Úfbgemmzdhttps://github.com/pytorch/vision/tree/main/references/classification#post-training-quantized-modelszImageNet-1Kg%�•CKS@g-²�ï§VW@)zacc@1zacc@5g'1¬Ú@gL7‰A`%7@zª
                These weights were produced by doing Post Training Quantization (eager mode) on top of the unquantized
                weights listed below.
            )
Ú
num_paramsÚmin_sizeÚ
categoriesÚbackendÚrecipeÚunquantizedÚ_metricsÚ_opsÚ
_file_sizeÚ_docs)ÚurlÚ
transformsÚmetar‘   N)r:   r;   r<   r=   r   r   r   r   r	   ÚIMAGENET1K_V1ÚIMAGENET1K_FBGEMM_V1ÚDEFAULTr?   r‘   r-   r+   r   r   ©   sa   † Ù"ØcÙÐ.¸#È3ÑOà"Ø Ø.ØØ|Ø/×=Ñ=àØ#Ø#ñ ðð Ø ðñ
ñÐð0 #ƒGr-   r   Úquantized_inception_v3)ÚnameÚ
pretrainedc                 óp   • U R                  SS5      (       a  [        R                  $ [        R                  $ )NÚquantizeF)Úgetr   rÃ   r	   rÂ   )r   s    r+   Ú<lambda>rË   É   s1   € à�z‰z˜* e×,Ñ,ô *×>Ñ>ð 4ä%×3Ñ3ð4r-   )ÚweightsTF)rÌ   ÚprogressrÉ   rÌ   rÍ   rÉ   r   r    c                 óv  • U(       a  [         O[        R                  U 5      n UR                  SS5      nU bm  SU;  a  [	        USS5        [	        USS5        [	        US[        U R                  S   5      5        SU R                  ;   a  [	        USU R                  S   5        UR                  SS	5      n[        S0 UD6n[        U5        U(       a  [        Xe5        U bW  U(       a  U(       d  SUl        SUl        UR                  U R                  USS
95        U(       d  U(       d  SUl        SUl        U$ )a6  Inception v3 model architecture from
`Rethinking the Inception Architecture for Computer Vision <http://arxiv.org/abs/1512.00567>`__.

.. note::
    **Important**: In contrast to the other models the inception_v3 expects tensors with a size of
    N x 3 x 299 x 299, so ensure your images are sized accordingly.

.. note::
    Note that ``quantize = True`` returns a quantized model with 8 bit
    weights. Quantized models only support inference and run on CPUs.
    GPU inference is not yet supported.

Args:
    weights (:class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` or :class:`~torchvision.models.Inception_V3_Weights`, optional): The pretrained
        weights for the model. See
        :class:`~torchvision.models.quantization.Inception_V3_QuantizedWeights` below for
        more details, and possible values. By default, no pre-trained
        weights are used.
    progress (bool, optional): If True, displays a progress bar of the download to stderr.
        Default is True.
    quantize (bool, optional): If True, return a quantized version of the model.
        Default is False.
    **kwargs: parameters passed to the ``torchvision.models.quantization.QuantizableInception3``
        base class. Please refer to the `source code
        <https://github.com/pytorch/vision/blob/main/torchvision/models/quantization/inception.py>`_
        for more details about this class.

.. autoclass:: torchvision.models.quantization.Inception_V3_QuantizedWeights
    :members:

.. autoclass:: torchvision.models.Inception_V3_Weights
    :members:
    :noindex:
r¡   FNÚtransform_inputTÚnum_classesr·   r¸   r´   )rÍ   Ú
check_hashr‘   )r   r	   ÚverifyrÊ   r   ÚlenrÁ   Úpopr   r   r   r¡   Ú	AuxLogitsÚload_state_dictÚget_state_dict)rÌ   rÍ   rÉ   r   Úoriginal_aux_logitsr¸   Úmodels          r+   r   r   Å   s  € öh 19Õ,Ô>R×ZÑZÐ[bÓc€Gà Ÿ*™* \°5Ó9ÐØÑØ FÓ*Ü! &Ð*;¸TÔBÜ˜f l°DÔ9Ü˜f m´S¸¿¹ÀlÑ9SÓ5TÔUØ˜Ÿ™Ó$Ü! &¨)°W·\±\À)Ñ5LÔMØ�j‰j˜ HÓ-€Gä!Ñ+ FÑ+€EÜ�%ÔÞÜ�uÔ&àÑÞÖ/Ø$ˆEÔØ"ˆEŒOØ×Ñ˜g×4Ñ4¸hÐSWÐ4ÐXÔYÞÖ 3Ø$ˆEÔØ"ˆEŒOà€Lr-   )7r¤   Ú	functoolsr   Útypingr   r   r   r–   Útorch.nnr%   Útorch.nn.functionalÚ
functionalrƒ   r   Útorchvision.modelsr   Úinception_moduleÚtorchvision.models.inceptionr	   r
   Útransforms._presetsr   Ú_apir   r   r   Ú_metar   Ú_utilsr   r   Úutilsr   r   r   Ú__all__ÚBasicConv2dr   Ú
InceptionArC   Ú
InceptionBr[   Ú
InceptionCrb   Ú
InceptionDri   Ú
InceptionErp   ÚInceptionAuxr�   Ú
Inception3r   r   r>   r   r‘   r-   r+   Ú<module>rð      su  ðÛ Ý ß 'Ñ 'ã Ý ß Ð Ý Ý <ß Oå 6ß 7Ñ 7Ý (ß Cß ?Ñ ?ò€ôJÐ-×9Ñ9ô Jô)Ð,×7Ñ7ô )ô)Ð,×7Ñ7ô )ô)Ð,×7Ñ7ô )ô)Ð,×7Ñ7ô )ô*Ð,×7Ñ7ô *ôDMÐ.×;Ñ;ô Mô)%Ð,×7Ñ7ô )%ôX# Kô #ñ8 Ð-Ñ.Ùàñ	
ðñ	ð UYØØò	Cà�eÐ9Ð;OÐOÑPÑQðCð ðCð ð	Cð
 ðCð ôCó	ó /ñCr-   