+
     °³jë!  ã                   óÜ   € ^ RI Ht ^ RIHtHt ^ RIHu Ht ^ RI	HtH
t
 ^RIHt ^RIHt  ! R R]P                  4      t ! R	 R
]P                  4      t ! R R]4      t ! R R]4      tR# )é    )ÚOrderedDict)ÚCallableÚOptionalN)ÚnnÚTensor)ÚConv2dNormActivation)Ú_log_api_usage_oncec                   ó6   a € ] tR t^t o RtV 3R lR ltRtV tR# )ÚExtraFPNBlocka~  
Base class for the extra block in the FPN.

Args:
    results (List[Tensor]): the result of the FPN
    x (List[Tensor]): the original feature maps
    names (List[str]): the names for each one of the
        original feature maps

Returns:
    results (List[Tensor]): the extended set of results
        of the FPN
    names (List[str]): the extended set of names for the results
c                ó˜   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          RS[ S[,          RS[S[ S[,          S[ S[,          3,          /# )é   ÚresultsÚxÚnamesÚreturn©Úlistr   ÚstrÚtuple)ÚformatÚ__classdict__s   "€Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchvision/ops/feature_pyramid_network.pyÚ__annotate__ÚExtraFPNBlock.__annotate__   sQ   ø€ ÷ ñ á‘f•ðñ ‘�<ðñ ‘C�yð	ñ
 
‰t‘F�|™T¡#�YÐ&Õ	'ñó    c                ó   € R # )N© )Úselfr   r   r   s   &&&&r   ÚforwardÚExtraFPNBlock.forward   s   € ñ 	r   r   N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s   ø‡ € ñ÷ö r   r   c                   óŒ   a a€ ] tR t^$t oRt^tRV3R lV 3R llltV 3R ltV3R lR ltV3R lR lt	V3R	 lR
 lt
RtVtV ;t# )ÚFeaturePyramidNetworkaë  
Module that adds a FPN from on top of a set of feature maps. This is based on
`"Feature Pyramid Network for Object Detection" <https://arxiv.org/abs/1612.03144>`_.

The feature maps are currently supposed to be in increasing depth
order.

The input to the model is expected to be an OrderedDict[Tensor], containing
the feature maps on top of which the FPN will be added.

Args:
    in_channels_list (list[int]): number of channels for each feature map that
        is passed to the module
    out_channels (int): number of channels of the FPN representation
    extra_blocks (ExtraFPNBlock or None): if provided, extra operations will
        be performed. It is expected to take the fpn features, the original
        features and the names of the original features as input, and returns
        a new list of feature maps and their corresponding names
    norm_layer (callable, optional): Module specifying the normalization layer to use. Default: None

Examples::

    >>> m = torchvision.ops.FeaturePyramidNetwork([10, 20, 30], 5)
    >>> # get some dummy data
    >>> x = OrderedDict()
    >>> x['feat0'] = torch.rand(1, 10, 64, 64)
    >>> x['feat2'] = torch.rand(1, 20, 16, 16)
    >>> x['feat3'] = torch.rand(1, 30, 8, 8)
    >>> # compute the FPN on top of x
    >>> output = m(x)
    >>> print([(k, v.shape) for k, v in output.items()])
    >>> # returns
    >>>   [('feat0', torch.Size([1, 5, 64, 64])),
    >>>    ('feat2', torch.Size([1, 5, 16, 16])),
    >>>    ('feat3', torch.Size([1, 5, 8, 8]))]

c                óŠ   <€ V ^8„  d   QhRS[ S[,          RS[RS[S[,          RS[S[RS[P                  3,          ,          /# )r   Úin_channels_listÚout_channelsÚextra_blocksÚ
norm_layer.)r   Úintr   r   r   r   ÚModule)r   r   s   "€r   r   Ú"FeaturePyramidNetwork.__annotate__M   sN   ø€ ÷ !)ñ !)á™s�)ð!)ñ ð!)ñ ™}Õ-ð	!)ñ
 ™X c©2¯9©9 nÕ5Õ6ñ!)r   c           
     ó,  <€ \         S	V `  4        \        V 4       \        P                  ! 4       V n        \        P                  ! 4       V n        V Fj  pV^ 8X  d   \        R4      h\        WR^^ VRR7      p\        W"^VRR7      pV P
                  P                  V4       V P                  P                  V4       Kl  	  V P                  4        FŠ  p\        V\        P                  4      '       g   K%  \        P                  P                  VP                  ^R7       VP                   f   K`  \        P                  P#                  VP                   ^ 4       KŒ  	  Ve.   \        V\$        4      '       g   \'        R\)        V4       24      hW0n        R# )r   z(in_channels=0 is currently not supportedN)Úkernel_sizeÚpaddingr0   Úactivation_layer)r5   r0   r7   ©Úaz1extra_blocks should be of type ExtraFPNBlock not )ÚsuperÚ__init__r	   r   Ú
ModuleListÚinner_blocksÚlayer_blocksÚ
ValueErrorr   ÚappendÚmodulesÚ
isinstanceÚConv2dÚinitÚkaiming_uniform_ÚweightÚbiasÚ	constant_r   Ú	TypeErrorÚtyper/   )
r   r-   r.   r/   r0   Úin_channelsÚinner_block_moduleÚlayer_block_moduleÚmÚ	__class__s
   &&&&&    €r   r;   ÚFeaturePyramidNetwork.__init__M   sC  ø€ ô 	‰ÑÔÜ˜DÔ!ÜŸMšM›OˆÔÜŸMšM›OˆÔÛ+ˆKØ˜aÔÜ Ð!KÓLÐLÜ!5Ø°qÀ!ÐPZÐmqô"Ðô "6Ø¸ÀjÐcgô"Ðð ×Ñ×$Ñ$Ð%7Ô8Ø×Ñ×$Ñ$Ð%7Ö8ñ ,ð —‘–ˆAÜ˜!œRŸY™Y×'Ô'Ü—‘×(Ñ(¨¯©°QÐ(Ô7Ø—6‘6Ô%Ü—G‘G×%Ñ% a§f¡f¨aÖ0ñ	  ð Ò#Ü˜l¬M×:Ò:ÜÐ"SÔTXÐYeÓTfÐSgÐ hÓiÐiØ(Ör   c           	     óD  <€ VP                  R R4      pVe   V^8  dm   \        V P                  4      p	R FQ  p
\        V	4       F?  pR F6  pV V
 RV RV 2pV V
 RV RV 2pWÑ9   g   K#  VP	                  V4      W&   K8  	  KA  	  KS  	  \
        SV `  VVVVVVV4       R# )ÚversionNÚ.z.0.)r=   r>   )rF   rG   )ÚgetÚlenr=   ÚrangeÚpopr:   Ú_load_from_state_dict)r   Ú
state_dictÚprefixÚlocal_metadataÚstrictÚmissing_keysÚunexpected_keysÚ
error_msgsrR   Ú
num_blocksÚblockÚirJ   Úold_keyÚnew_keyrO   s   &&&&&&&&       €r   rX   Ú+FeaturePyramidNetwork._load_from_state_dictp   sÄ   ø€ ð !×$Ñ$ Y°Ó5ˆàŠ?˜g¨œkÜ˜T×.Ñ.Ó/ˆJÛ9�Ü˜zÖ*�AÛ 2˜Ø%+ H¨U¨G°1°Q°C°q¸¸Ð"?˜Ø%+ H¨U¨G°1°Q°C°s¸4¸&Ð"A˜Ø"Ö0Ø2<·.±.ÀÓ2I˜JÓ/ó	 !3ó +ñ :ô 	‰Ñ%ØØØØØØØö	
r   c                ó,   <€ V ^8„  d   QhRS[ RS[RS[ /# ©r   r   Úidxr   ©r   r1   )r   r   s   "€r   r   r3   �   ó"   ø€ ÷ ñ ©fð ¹3ð Á6ñ r   c                ó®   € \        V P                  4      pV^ 8  d	   W#,          pTp\        V P                  4       F  w  rVWR8X  g   K  V! V4      pK  	  V# )z[
This is equivalent to self.inner_blocks[idx](x),
but torchscript doesn't support this yet
)rU   r=   Ú	enumerate©r   r   rh   r`   Úoutrb   Úmodules   &&&    r   Úget_result_from_inner_blocksÚ2FeaturePyramidNetwork.get_result_from_inner_blocks�   óT   € ô
 ˜×*Ñ*Ó+ˆ
Ø�Œ7ØÕˆCØˆÜ" 4×#4Ñ#4Ö5‰IˆAØŽxÙ˜Q“i’ñ 6ð ˆ
r   c                ó,   <€ V ^8„  d   QhRS[ RS[RS[ /# rg   ri   )r   r   s   "€r   r   r3   ž   rj   r   c                ó®   € \        V P                  4      pV^ 8  d	   W#,          pTp\        V P                  4       F  w  rVWR8X  g   K  V! V4      pK  	  V# )z[
This is equivalent to self.layer_blocks[idx](x),
but torchscript doesn't support this yet
)rU   r>   rl   rm   s   &&&    r   Úget_result_from_layer_blocksÚ2FeaturePyramidNetwork.get_result_from_layer_blocksž   rr   r   c                óR   <€ V ^8„  d   QhRS[ S[S[3,          RS[ S[S[3,          /# )r   r   r   )Údictr   r   )r   r   s   "€r   r   r3   ¬   s-   ø€ ÷  ñ  ™™c¡6˜kÕ*ð  ©t±C¹°KÕ/@ñ  r   c                óœ  € \        VP                  4       4      p\        VP                  4       4      pV P                  VR,          R4      p. pVP	                  V P                  VR4      4       \        \        V4      ^,
          RR4       Fk  pV P                  W,          V4      pVP                  RR p\        P                  ! W7RR7      pWh,           pVP                  ^ V P                  W54      4       Km  	  V P                  e   V P                  WAV4      w  rB\        \        W$4       U	U
u. uF  w  ršWš3NK
  	  up
p	4      pV# u up
p	i )zþ
Computes the FPN for a set of feature maps.

Args:
    x (OrderedDict[Tensor]): feature maps for each feature level.

Returns:
    results (OrderedDict[Tensor]): feature maps after FPN layers.
        They are ordered from the highest resolution first.
NÚnearest)ÚsizeÚmodeéÿÿÿÿéþÿÿÿ)r   ÚkeysÚvaluesrp   r@   ru   rV   rU   ÚshapeÚFÚinterpolateÚinsertr/   r   Úzip)r   r   r   Ú
last_innerr   rh   Úinner_lateralÚ
feat_shapeÚinner_top_downÚkÚvrn   s   &&          r   r   ÚFeaturePyramidNetwork.forward¬   s  € ô �Q—V‘V“X“ˆÜ�—‘“Óˆà×6Ñ6°q¸µu¸bÓAˆ
ØˆØ�‰�t×8Ñ8¸ÀRÓHÔIäœ˜Q› !� R¨Ö,ˆCØ ×=Ñ=¸a½fÀcÓJˆMØ&×,Ñ,¨R¨SÐ1ˆJÜŸ]š]¨:ÈYÔWˆNØ&Õ7ˆJØ�N‰N˜1˜d×?Ñ?À
ÓPÖQñ -ð ×ÑÒ(Ø!×.Ñ.¨w¸5ÓA‰NˆGô ¬c°%Ô.AÔBÑ.A¡d a˜A›6Ñ.AÒBÓCˆàˆ
ùó Cs   Ä0E
)r/   r=   r>   )NN)r"   r#   r$   r%   r&   Ú_versionr;   rX   rp   ru   r   r'   r(   Ú__classcell__©rO   r   s   @@r   r+   r+   $   sF   ù‡ € ñ$ðL €H÷!)õ !)õF
÷@ð ÷ð ÷ ÷  ð  r   r+   c                   ó6   a € ] tR t^Ït o RtV 3R lR ltRtV tR# )ÚLastLevelMaxPoolz`
Applies a max_pool2d (not actual max_pool2d, we just subsample) on top of the last feature map
c                ó˜   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          RS[ S[,          RS[S[ S[,          S[ S[,          3,          /# )r   r   Úyr   r   r   )r   r   s   "€r   r   ÚLastLevelMaxPool.__annotate__Ô   sQ   ø€ ÷ 	ñ 	á‘�<ð	ñ ‘�<ð	ñ ‘C�yð		ñ
 
‰t‘F�|™T¡#�YÐ&Õ	'ñ	r   c           	     óŠ   € VP                  R 4       VP                  \        P                  ! VR,          ^^^ R7      4       W3# )Úpool)r5   Ústrider6   r}   )r@   r‚   Ú
max_pool2d)r   r   r“   r   s   &&&&r   r   ÚLastLevelMaxPool.forwardÔ   s6   € ð 	�‰�VÔà	�‰”—’˜a �e°¸1ÀaÔHÔIØˆxˆr   r   Nr!   r)   s   @r   r‘   r‘   Ï   s   ø‡ € ñ÷	ö 	r   r‘   c                   óT   a a€ ] tR t^àt oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )ÚLastLevelP6P7zG
This module is used in RetinaNet to generate extra layers, P6 and P7.
c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r   rK   r.   )r1   )r   r   s   "€r   r   ÚLastLevelP6P7.__annotate__å   s   ø€ ÷ 2ñ 2¡Cð 2±sñ 2r   c                ó–  <€ \         SV `  4        \        P                  ! W^^^4      V n        \        P                  ! W"^^^4      V n        V P                  V P
                  3 FX  p\        P                  P                  VP                  ^R7       \        P                  P                  VP                  ^ 4       KZ  	  W8H  V n        R# )é   r8   N)r:   r;   r   rC   Úp6Úp7rD   rE   rF   rH   rG   Úuse_P5)r   rK   r.   ro   rO   s   &&& €r   r;   ÚLastLevelP6P7.__init__å   s�   ø€ Ü‰ÑÔÜ—)’)˜K°q¸!¸QÓ?ˆŒÜ—)’)˜L¸¸1¸aÓ@ˆŒØ—w‘w §¡Ó(ˆFÜ�G‰G×$Ñ$ V§]¡]°aÐ$Ô8Ü�G‰G×Ñ˜fŸk™k¨1Ö-ñ )ð "Ñ1ˆŽr   c                ó˜   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          RS[ S[,          RS[S[ S[,          S[ S[,          3,          /# )r   ÚpÚcr   r   r   )r   r   s   "€r   r   r�   î   sQ   ø€ ÷ ñ á‘�<ðñ ‘�<ðñ ‘C�yð	ñ
 
‰t‘F�|™T¡#�YÐ&Õ	'ñr   c                ó  € VR,          VR,          rTV P                   '       d   TMTpV P                  V4      pV P                  \        P                  ! V4      4      pVP                  Wx.4       VP                  RR.4       W3# )é   r    r¡   r}   )r¢   r    r¡   r‚   ÚreluÚextend)	r   r¥   r¦   r   Úp5Úc5r   r    r¡   s	   &&&&     r   r   ÚLastLevelP6P7.forwardî   sj   € ð �2•˜˜"�ˆBØ—+—+�+‰B 2ˆØ�W‰W�Q‹ZˆØ�W‰W”Q—V’V˜B“ZÓ ˆØ	�‰�"�ÔØ�‰�d˜D�\Ô"Øˆxˆr   )r    r¡   r¢   )
r"   r#   r$   r%   r&   r;   r   r'   r(   rŽ   r�   s   @@r   r›   r›   à   s#   ù‡ € ñ÷2ó 2÷÷ ð r   r›   )Úcollectionsr   Útypingr   r   Útorch.nn.functionalr   Ú
functionalr‚   Útorchr   Úops.miscr   Úutilsr	   r2   r   r+   r‘   r›   r   r   r   Ú<module>rµ      sU   ðÝ #ß %ç Ð ß å +Ý 'ô�B—I‘Iô ô2h˜BŸI™Iô hôV�}ô ô"�Mö r   