+
     °³j¸/  ã                   ó&  € ^ RI t ^ RIHt ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHt ^RIHt ^R	IHtHt R
 tR tR t]! RR7      R 4       t]P2                  P4                  RR R ll4       t ! R R]P8                  4      tR# )é    N)ÚUnion)ÚnnÚTensor)Úis_compile_supported)ÚBroadcastingList2)Ú_pair)Ú_assert_has_opsÚ_has_ops)Ú_log_api_usage_once)Úcheck_roi_boxes_shapeÚconvert_boxes_to_roi_formatc                 ó   a € V 3R lpV# )zcLazily wrap a function with torch.compile on the first call

This avoids eagerly importing dynamo.
c                 óJ   <a € \         P                  ! S 4      VV 3R  l4       pV# )c                  ó¤   <€ \         P                  ! S3/ SB p\        P                  ! S4      ! V4      \	        4       SP
                  &   V! V / VB # ©N)ÚtorchÚcompileÚ	functoolsÚwrapsÚglobalsÚ__name__)ÚargsÚkwargsÚcompiled_fnÚcompile_kwargsÚfns   *, €€ÚZ/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchvision/ops/roi_align.pyÚcompile_hookÚ7lazy_compile.<locals>.decorate_fn.<locals>.compile_hook   sD   ø€ äŸ-š-¨Ñ=¨nÑ=ˆKÜ%.§_¢_°RÔ%8¸Ó%EŒG‹I�b—k‘kÑ"Ù Ð/¨Ñ/Ð/ó    )r   r   )r   r   r   s   f €r   Údecorate_fnÚ!lazy_compile.<locals>.decorate_fn   s&   ù€ Ü	�Š˜Ó	õ	0ó 
ð	0ð
 Ðr    © )r   r!   s   l r   Úlazy_compiler$      s   ø€ õð Ðr    c                 óL  a aaaa€ S P                  4       w  porxVP                  ^ R7      pVP                  ^ R7      pVP                  4       p	VP                  4       p
\        P                  ! W—^,
          8¬  V^,
          V	^,           4      p\        P                  ! W—^,
          8¬  V^,
          V	4      p	\        P                  ! W—^,
          8¬  VP                  S P                  4      V4      p\        P                  ! W¨^,
          8¬  V^,
          V
^,           4      p\        P                  ! W¨^,
          8¬  V^,
          V
4      p
\        P                  ! W¨^,
          8¬  VP                  S P                  4      V4      pW),
          pW:,
          pRV,
          pRV,
          pVV VVV3R lpV! Wš4      pV! Wœ4      pV! Wº4      pV! W¼4      pR pV! VV4      pV! Wþ4      pV! VV4      pV! WÞ4      pVV,          VV,          ,           VV,          ,           VV,          ,           pV# )r   ©Úminç      ð?c                 ó&  <€ SeE   Sf   Q h\         P                  ! SR,          V ^ 4      p \         P                  ! SR,          V^ 4      pSSR,          \         P                  ! SSP                  R7      R,          V R,          VR,          3,          # )N©Údevice)ºNNNNr,   )r,   NNNNN)Nr,   NNNN©r,   Nr,   Nr,   N©r,   NNr,   Nr,   )r   ÚwhereÚaranger+   )ÚyÚxÚchannelsÚinputÚroi_batch_indÚxmaskÚymasks   &&€€€€€r   Úmasked_indexÚ+_bilinear_interpolate.<locals>.masked_indexB   sŠ   ø€ ð ÒØÒ$Ð$Ð$Ü—’˜E *Õ-¨q°!Ó4ˆAÜ—’˜E *Õ-¨q°!Ó4ˆAØØÐ9Õ:Ü�LŠL˜¨%¯,©,Ô7Ð8WÕXØÐ'Õ(ØÐ'Õ(ð*õ
ð 	
r    c                 ó0   € V R,          VR,          ,          # )r,   r-   r.   r#   )r1   r2   s   &&r   Ú
outer_prodÚ)_bilinear_interpolate.<locals>.outer_prodW   s   € ØÐ*Õ+¨aÐ0IÕ.JÕJÐJr    )ÚsizeÚclampÚintr   r/   ÚtoÚdtype)r4   r5   r1   r2   r7   r6   Ú_ÚheightÚwidthÚy_lowÚx_lowÚy_highÚx_highÚlyÚlxÚhyÚhxr8   Úv1Úv2Úv3Úv4r;   Úw1Úw2Úw3Úw4Úvalr3   s   ff&&ff                      @r   Ú_bilinear_interpolaterV   #   sÆ  ü€ ð "'§¡£Ñ€A€x�ð 	
�‰�Aˆ‹€AØ	�‰�Aˆ‹€AØ�E‰E‹G€EØ�E‰E‹G€EÜ�[Š[˜¨1¥*Ñ,¨f°q­j¸%À!½)ÓD€FÜ�KŠK˜¨!¥Ñ+¨V°a­Z¸Ó?€EÜ�Š�E a�ZÑ'¨¯©¨e¯k©kÓ):¸AÓ>€Aä�[Š[˜¨!¥)Ñ+¨U°Q­Y¸À½	ÓB€FÜ�KŠK˜¨¥Ñ*¨E°A­I°uÓ=€EÜ�Š�E Q�YÑ&¨¯©¨U¯[©[Ó(9¸1Ó=€Aà	
�€BØ	
�€BØ	ˆr�€BØ	ˆr�€B÷

ñ 
ñ 
�eÓ	#€BÙ	�eÓ	$€BÙ	�fÓ	$€BÙ	�fÓ	%€BòKñ 
�B˜Ó	€BÙ	�BÓ	€BÙ	�B˜Ó	€BÙ	�BÓ	€Bà
ˆr�'�B˜•GÕ
˜b 2�gÕ
%¨¨R­Õ
/€CØ€Jr    c                 ó¾   € \         P                  ! 4       '       dB   V P                  '       d0   V P                  \         P                  8w  d   V P                  4       # V # r   )r   Úis_autocast_enabledÚis_cudarA   ÚdoubleÚfloat)Útensors   &r   Ú
maybe_castr]   e   s9   € Ü× Ò ×"Ò" v§~§~ ~¸&¿,¹,Ì%Ï,É,Ô:VØ�|‰|‹~Ðàˆr    T)Údynamicc                 ó&  € V P                   p\        V 4      p \        V4      pV P                  4       w   r‰p
\        P                  ! W0P
                  R 7      p\        P                  ! W@P
                  R 7      pVR,          P                  4       pV'       d   RMRpVR,          V,          V,
          pVR	,          V,          V,
          pVR
,          V,          V,
          pVR,          V,          V,
          pVV,
          pVV,
          pV'       g1   \        P                  ! VRR7      p\        P                  ! VRR7      pVV,          pVV,          pV^ 8„  pV'       d   TM\        P                  ! VV,          4      pV'       d   TM\        P                  ! VV,          4      p V'       d]   \        VV,          ^4      p\        P                  ! VV P
                  R 7      p\        P                  ! VV P
                  R 7      pRpRpM‡\        P                  ! VV,          ^R7      p\        P                  ! W�P
                  R 7      p\        P                  ! W P
                  R 7      pVR,          VR,          8  pVR,          VR,          8  pR pV! V4      VR,          V! V4      ,          ,           VR,          R,           P                  V P                   4      V! VV,          4      ,          ,           p V! V4      VR,          V! V4      ,          ,           VR,          R,           P                  V P                   4      V! VV,          4      ,          ,           p!\        WV V!VV4      p"V'       g?   \        P                  ! VR,          V"^ 4      p"\        P                  ! VR,          V"^ 4      p"V"P                  R4      p#\        V\        P                  4      '       d   V#VR,          ,          p#M	V#V,          p#V#P                  V4      p#V## )r*   g      à?g        r(   r&   Nc                 ó   € V R,          # )r,   )r,   NNr#   )Úts   &r   Úfrom_KÚ_roi_align.<locals>.from_K¬   s   € Ø�ÕÐr    )r,   r   )r,   é   )r,   é   )r,   é   )r,   é   )Nr,   )r,   N)Nr,   N)NNr,   )r,   NNNr,   N)r,   NNNNr,   )éÿÿÿÿéþÿÿÿ)r,   NNN)rA   r]   r=   r   r0   r+   r?   r>   ÚceilÚmaxr@   rV   r/   ÚsumÚ
isinstancer   )$r4   ÚroisÚspatial_scaleÚpooled_heightÚpooled_widthÚsampling_ratioÚalignedÚ
orig_dtyperB   rC   rD   ÚphÚpwr5   ÚoffsetÚroi_start_wÚroi_start_hÚ	roi_end_wÚ	roi_end_hÚ	roi_widthÚ
roi_heightÚ
bin_size_hÚ
bin_size_wÚexact_samplingÚroi_bin_grid_hÚroi_bin_grid_wÚcountÚiyÚixr7   r6   rb   r1   r2   rU   Úoutputs$   &&&&&&&                             r   Ú
_roi_alignr‡   r   s6  € à—‘€Jä�uÓ€EÜ�dÓ€DàŸ*™*›,Ñ€A€q�%ä	�Š�m¯L©LÔ	9€BÜ	�Š�l¯<©<Ô	8€Bð
 ˜•J—N‘NÓ$€Mß‰S €FØ�t•*˜}Õ,¨vÕ5€KØ�t•*˜}Õ,¨vÕ5€KØ�T•
˜]Õ*¨VÕ3€IØ�T•
˜]Õ*¨VÕ3€Ià˜KÕ'€IØ˜[Õ(€JßÜ—K’K 	¨sÔ3ˆ	Ü—[’[ °Ô5ˆ
à˜mÕ+€JØ˜\Õ)€Jà# aÑ'€Nç'5‘^¼5¿:º:ÀjÐS`ÕF`Ó;a€Nß'5‘^¼5¿:º:ÀiÐR^ÕF^Ó;_€Nð÷ Ü�N ^Õ3°QÓ7ˆÜ�\Š\˜.°·±Ô>ˆÜ�\Š\˜.°·±Ô>ˆØˆØ‰ä—’˜N¨^Õ;ÀÔCˆô �\Š\˜&¯©Ô6ˆÜ�\Š\˜%¯©Ô5ˆØ�7•˜n¨WÕ5Ñ5ˆØ�7•˜n¨WÕ5Ñ5ˆò ñ 	ˆ{ÓØ
ˆ]Õ
™f ZÓ0Õ
0õ	1àˆmÕ˜sÕ"×
&Ñ
& u§{¡{Ó
3±f¸ZÈ.Õ=XÓ6YÕ
Yõ	Zð ñ 	ˆ{ÓØ
ˆ]Õ
™f ZÓ0Õ
0õ	1àˆmÕ˜sÕ"×
&Ñ
& u§{¡{Ó
3±f¸ZÈ.Õ=XÓ6YÕ
Yõ	Zð ô
   °a¸¸EÀ5Ó
I€C÷ Ü�kŠk˜%Ð <Õ=¸sÀAÓFˆÜ�kŠk˜%Ð <Õ=¸sÀAÓFˆà�W‰W�XÓ€FÜ�%œŸ™×&Ò&Ø�%Ð+Õ,Õ,‰à�%�ˆà�Y‰Y�zÓ"€Fà€Mr    c                óº   € V ^8„  d   QhR\         R\        \         \        \         ,          3,          R\        \        ,          R\
        R\        R\        R\         /# )re   r4   ÚboxesÚoutput_sizero   rr   rs   Úreturn)r   r   Úlistr   r?   r[   Úbool)Úformats   "r   Ú__annotate__r�   Ì   sj   € ÷ Qñ QÜðQä”œœf�Ð%Õ&ðQô #¤3Õ'ðQô ð	Qô
 ðQô ðQô ñQr    c                óv  € \         P                  P                  4       '       g4   \         P                  P                  4       '       g   \	        \
        4       \        V4       Tp\        V4      p\        V\         P                  4      '       g   \        V4      p\         P                  P                  4       '       gó   V P                  '       dá   \        4        V P                  4       pV P                  4       pV P                  4       p	VP                  '       g   \!        R4      hVP                  4       p
VP                  4       pVP                  4       p\         P"                  P$                  P'                  V	VVVV
VVV^ ,          V^,          VV4      p\         P(                  ! W×VR7      # \         P                  P                  4       '       g£   \+        4       '       dR   \         P,                  ! 4       '       dx   V P.                  '       g%   V P0                  '       g   V P2                  '       dB   \5        V P6                  P8                  4      '       d   \;        WW2^ ,          V^,          WE4      # \        4        \         P"                  P$                  P                  WW2^ ,          V^,          WE4      # )aö  
Performs Region of Interest (RoI) Align operator with average pooling, as described in Mask R-CNN.

Args:
    input (Tensor[N, C, H, W]): The input tensor, i.e. a batch with ``N`` elements. Each element
        contains ``C`` feature maps of dimensions ``H x W``.
        If the tensor is quantized, we expect a batch size of ``N == 1``.
    boxes (Tensor[K, 5] or List[Tensor[L, 4]]): the box coordinates in (x1, y1, x2, y2)
        format where the regions will be taken from.
        The coordinate must satisfy ``0 <= x1 < x2`` and ``0 <= y1 < y2``.
        If a single Tensor is passed, then the first column should
        contain the index of the corresponding element in the batch, i.e. a number in ``[0, N - 1]``.
        If a list of Tensors is passed, then each Tensor will correspond to the boxes for an element i
        in the batch.
    output_size (int or Tuple[int, int]): the size of the output (in bins or pixels) after the pooling
        is performed, as (height, width).
    spatial_scale (float): a scaling factor that maps the box coordinates to
        the input coordinates. For example, if your boxes are defined on the scale
        of a 224x224 image and your input is a 112x112 feature map (resulting from a 0.5x scaling of
        the original image), you'll want to set this to 0.5. Default: 1.0
    sampling_ratio (int): number of sampling points in the interpolation grid
        used to compute the output value of each pooled output bin. If > 0,
        then exactly ``sampling_ratio x sampling_ratio`` sampling points per bin are used. If
        <= 0, then an adaptive number of grid points are used (computed as
        ``ceil(roi_width / output_width)``, and likewise for height). Default: -1
    aligned (bool): If False, use the legacy implementation.
        If True, pixel shift the box coordinates it by -0.5 for a better alignment with the two
        neighboring pixel indices. This version is used in Detectron2

Returns:
    Tensor[K, C, output_size[0], output_size[1]]: The pooled RoIs.
z3If input is quantized, rois must also be quantized.)ÚscaleÚ
zero_point)r   ÚjitÚis_scriptingÚ
is_tracingr   Ú	roi_alignr   r   rm   r   r   Úis_quantizedr	   Úq_scaleÚq_zero_pointÚint_reprÚ
ValueErrorÚopsÚtorchvisionÚ
qroi_alignÚ!_make_per_tensor_quantized_tensorr
   Ú$are_deterministic_algorithms_enabledrY   Úis_mpsÚis_xpur   r+   Útyper‡   )r4   r‰   rŠ   ro   rr   rs   rn   Úinput_scaleÚinput_zero_pointÚint_dataÚ
rois_scaleÚrois_zero_pointÚrois_intÚout_ints   &&&&&&        r   r–   r–   Ë   sð  € ôR �9‰9×!Ñ!×#Ò#¬E¯I©I×,@Ñ,@×,BÒ,BÜœIÔ&Ü˜%Ô Ø€DÜ˜Ó$€KÜ�dœEŸL™L×)Ò)Ü*¨4Ó0ˆÜ�9‰9×!Ñ!×#Ò#¨×(:×(:Ð(:ÜÔØ—m‘m“oˆØ ×-Ñ-Ó/ÐØ—>‘>Ó#ˆØ× × Ð ÜÐRÓSÐSØ—\‘\“^ˆ
Ø×+Ñ+Ó-ˆØ—=‘=“?ˆÜ—)‘)×'Ñ'×2Ñ2ØØØØØØØØ˜�NØ˜�NØØó
ˆô ×6Ò6°wÐ^nÔoÐoä�9‰9×!Ñ!×#Ò#ä—
’
Ü×:Ò:×<Ò<À%Ç-Ç-À-ÐSX×S_×S_ÐS_Ðch×co×coÐcoÜ" 5§<¡<×#4Ñ#4×5Ò5Ü˜e¨=Àa½.È+ÐVWÍ.ÐZhÓrÐrÜÔÜ�9‰9× Ñ ×*Ñ*Ø�]°¥N°KÀµNÀNóð r    c                   ój   a a€ ] tR tRt oRtR
V3R lV 3R llltV3R lR ltV3R lR ltR	tVt	V ;t
# )ÚRoIAligni   z
See :func:`roi_align`.
c                óB   <€ V ^8„  d   QhRS[ S[,          RS[RS[RS[/# )re   rŠ   ro   rr   rs   )r   r?   r[   r�   )rŽ   Ú__classdict__s   "€r   r�   ÚRoIAlign.__annotate__%  s8   ø€ ÷ ñ á&¡sÕ+ðñ ðñ ð	ñ
 ñr    c                ój   <€ \         SV `  4        \        V 4       Wn        W n        W0n        W@n        R # r   )ÚsuperÚ__init__r   rŠ   ro   rr   rs   )ÚselfrŠ   ro   rr   rs   Ú	__class__s   &&&&&€r   r²   ÚRoIAlign.__init__%  s/   ø€ ô 	‰ÑÔÜ˜DÔ!Ø&ÔØ*ÔØ,ÔØŽr    c                óR   <€ V ^8„  d   QhRS[ RS[S[ S[S[ ,          3,          RS[ /# )re   r4   rn   r‹   )r   r   rŒ   )rŽ   r®   s   "€r   r�   r¯   3  s5   ø€ ÷ oñ o™Vð o©5±¹¹f½Ð1EÕ+Fð oÉ6ñ or    c                óp   € \        WV P                  V P                  V P                  V P                  4      # r   )r–   rŠ   ro   rr   rs   )r³   r4   rn   s   &&&r   ÚforwardÚRoIAlign.forward3  s.   € Ü˜ d×&6Ñ&6¸×8JÑ8JÈD×L_ÑL_Ðae×amÑamÓnÐnr    c                ó    <€ V ^8„  d   QhRS[ /# )re   r‹   )Ústr)rŽ   r®   s   "€r   r�   r¯   6  s   ø€ ÷ 	ñ 	™#ñ 	r    c           
     ó    € V P                   P                   R V P                   RV P                   RV P                   RV P
                   R2
pV# )z(output_size=z, spatial_scale=z, sampling_ratio=z
, aligned=Ú))r´   r   rŠ   ro   rr   rs   )r³   Úss   & r   Ú__repr__ÚRoIAlign.__repr__6  s^   € à�~‰~×&Ñ&Ð'ð (Ø×+Ñ+Ð,Ø˜t×1Ñ1Ð2Ø × 3Ñ 3Ð4Ø˜Ÿ™˜Øðð 	
ð ˆr    )rs   rŠ   rr   ro   )F)r   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r²   r¸   r¿   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r´   r®   s   @@r   r¬   r¬      s/   ù‡ € ñ÷õ ÷oð o÷	÷ 	ð 	r    r¬   )r(   rh   F)r   Útypingr   r   Útorch.fxr   r   Útorch._dynamo.utilsr   Útorch.jit.annotationsr   Útorch.nn.modules.utilsr   Útorchvision.extensionr	   r
   Úutilsr   Ú_utilsr   r   r$   rV   r]   r‡   ÚfxÚwrapr–   ÚModuler¬   r#   r    r   Ú<module>rÓ      s�   ðÛ Ý ã Û ß Ý 4Ý 3Ý (ß ;å 'ß Fòò&=òDñ �dÔñUó ðUðp ‡�‡�öQó ðQôhˆr�y‰yö r    