+
    åûj"  ã                   ó‚   € ^ RI HtHtHt ^ RIt^ RIHt  ! R R]P                  4      t ! R R]P                  4      tR# )é    )ÚAnyÚOptionalÚTupleN)Únnc                   ód   a a€ ] tR t^t oRtRRR^/V3R lV 3R llltR
V3R lR lltR	tVtV ;t	# )ÚDecoderzÿImplement the decoder module for DeDoDe feature extraction.

Args:
    layers: The architectural layers for the decoder.
    super_resolution: Whether to apply super-resolution upsampling.
    num_prototypes: The number of prototypes for the output head.
Úsuper_resolutionFÚnum_prototypesc                ó0   <€ V ^8„  d   QhRS[ RS[RS[RR/# )é   Úlayersr	   r
   ÚreturnN)r   ÚboolÚint)ÚformatÚ__classdict__s   "€ÚYC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\dedode\decoder.pyÚ__annotate__ÚDecoder.__annotate__!   s+   ø€ ÷ -ñ -™sð -¹Tð -Ñ[^ð -Ðquñ -ó    c               óŠ   <€ \         SV `  ! V/ VB  Wn        V P                  P                  4       V n        W n        W0n        R # )N)ÚsuperÚ__init__r   ÚkeysÚscalesr	   r
   )Úselfr   r	   r
   ÚargsÚkwargsÚ	__class__s   &&$$*,€r   r   ÚDecoder.__init__!   s:   ø€ Ü‰Ò˜$Ð) &Ò)ØŒØ—k‘k×&Ñ&Ó(ˆŒØ 0ÔØ,Ör   c                óÈ   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[S[,          RS[S[ P                  S[S[ P                  ,          3,          /# )r   ÚfeaturesÚcontextÚscaler   )ÚtorchÚTensorr   r   r   )r   r   s   "€r   r   r   (   sW   ø€ ÷ ñ ÙŸ™ðÙ/7¹¿¹Õ/EðÙU]Ñ^aÕUbðá	‰u�|‰|™X¡e§l¡lÕ3Ð3Õ	4ñr   c                óÎ   € Ve   \         P                  ! W3^R7      pV P                  V,          ! V4      pVRRV P                  13,          VRV P                  R13,          r%WR3# )aÖ  Run this DeDoDe module forward.

Args:
    features: Encoded feature map with shape ``(B, C, H, W)``, or concatenated with context.
    context: Optional context feature map from previous scale, shape
        :math:`(B, C_{\text{ctx}}, H, W)`, or ``None``.
    scale: String key selecting the decoder layer for this scale (e.g. ``"8"``, ``"4"``, ``"2"``, ``"1"``).

Returns:
    Tuple of ``(logits, context)`` tensors, each with shape :math:`(B, C_{\text{out}}, H, W)`.
N)Údim:NNN)r%   Úcatr   r
   )r   r"   r#   r$   ÚstuffÚlogitss   &&&&  r   ÚforwardÚDecoder.forward(   sh   € ð ÒÜ—y’y (Ð!4¸!Ô<ˆHØ—‘˜EÖ" 8Ó,ˆØ Ð#8 T×%8Ñ%8Ð#8Ð 8Õ9¸5ÀÀD×DWÑDWÑDYÐAYÕ;Z�ØˆÐr   )r   r
   r   r	   )NN)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r,   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   r   s   @@r   r   r      s2   ù‡ € ñð-ÀEð -Ðab÷ -õ -÷÷ ò r   r   c            	       ó˜   a a€ ] tR t^=t oRt^^^R^^RR]P                  3	V 3R lltR^R]P                  3R lt
V3R lR ltRtVtV ;t# )	ÚConvRefinera'  Implement a convolutional refiner for DeDoDe feature extraction.

Args:
    in_dim: The input dimension for the refiner.
    hidden_dim: The hidden dimension for the refiner.
    out_dim: The output dimension for the refiner.
    dw: Whether to use depthwise convolution.
    kernel_size: The kernel size for the convolution.
    hidden_blocks: The number of hidden blocks in the refiner.
    amp: Whether to use automatic mixed precision.
    residual: Whether to use residual connections.
    amp_dtype: The data type for automatic mixed precision.
TFc
                óL  <€ \         SV `  4        V P                  VVR ^R7      V n        \        P
                  ! \        V4       U
u. uF  p
V P                  VVVVR7      NK  	  up
!  V n        \        P                  ! W#^^^ 4      V n	        Wpn
        W�n        W€n        R# u up
i )F)ÚdwÚkernel_sizeN)r   r   Úcreate_blockÚblock1r   Ú
SequentialÚrangeÚhidden_blocksÚConv2dÚout_convÚampÚ	amp_dtypeÚresidual)r   Úin_dimÚ
hidden_dimÚout_dimr:   r;   r@   rC   rE   rD   Úhbr   s   &&&&&&&&&& €r   r   ÚConvRefiner.__init__L   s´   ø€ ô 	‰ÑÔØ×'Ñ'ØØØØð	 (ó 
ˆŒô  Ÿ]š]ô   Ô.óñ /�Bð ×!Ñ!ØØØØ +ð	 "ö ñ /ññ

ˆÔô Ÿ	š	 *°q¸!¸QÓ?ˆŒØŒØ"ŒØ Žùòs   ÁB!c           
     óz  € V'       g   ^MTpV'       d   W!,          ^ 8w  d   \        R4      h\        P                  ! VVV^V^,          VVR7      pV\        P                  J d	   V! V4      MV! VR7      p	\        P                  ! RR7      p
\        P                  ! W"^^^ 4      p\        P
                  ! W‰W«4      # )aæ  Create one decoder block for the requested scale.

Args:
    in_dim: Number of input channels.
    out_dim: Number of output channels. Must be divisible by ``in_dim`` when ``dw=True``.
    dw: Whether to use depthwise convolution.
    kernel_size: Convolution kernel size.
    bias: Whether to include bias in the convolution.
    norm_type: Normalization layer class to apply after the first conv.

Returns:
    Decoder block (``nn.Sequential``) configured for the requested channels.
z=out_dim must be divisible by in_dim for depthwise convolution)r;   ÚstrideÚpaddingÚgroupsÚbias)Únum_channelsT)Úinplace)Ú
ValueErrorr   rA   ÚBatchNorm2dÚReLUr>   )r   rF   rH   r:   r;   rO   Ú	norm_typeÚ
num_groupsÚconv1ÚnormÚreluÚconv2s   &&&&&&&     r   r<   ÚConvRefiner.create_blocko   s    € ÷, !‘Q fˆ
ß�'Õ" aÔ'ÜÐ\Ó]Ð]Ü—	’	ØØØ#ØØ 1Õ$ØØô
ˆð &/´"·.±.Ó%@‰y˜Ô!ÁiÐ]dÔFeˆÜ�wŠw˜tÔ$ˆÜ—	’	˜'¨A¨q°!Ó4ˆÜ�}Š}˜U¨$Ó6Ð6r   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   Úfeatsr   )r%   r&   )r   r   s   "€r   r   ÚConvRefiner.__annotate__–   s#   ø€ ÷ $ñ $™UŸ\™\ð $©e¯l©lñ $r   c                ó˜  € VP                   w  r#rE\        P                  ! RV P                  ;'       d    VP                  V P
                  R7      ;_uu_ 4        V P                  V4      pV P                  V4      pV P                  '       d   Wv,           R,          pV P                  V4      uuRRR4       #   + '       g   i     R# ; i)zÁRun this DeDoDe module forward.

Args:
    feats: Input feature map with shape :math:`(B, C_{\text{in}}, H, W)`.

Returns:
    Refined feature map with shape :math:`(B, C_{\text{out}}, H, W)`.
Úcuda)ÚenabledÚdtypegffffffö?N)
Úshaper%   ÚautocastrC   Úis_cudarD   r=   r@   rE   rB   )r   r]   Ú_bÚ_cÚ_hsÚ_wsÚx0Úxs   &&      r   r,   ÚConvRefiner.forward–   s‡   € ð !Ÿ;™;Ñˆ�ä�^Š^˜F¨D¯H©H×,FÐ,F¸¿¹ÈdÏnÉn×]Ö]Ø—‘˜UÓ#ˆBØ×"Ñ" 2Ó&ˆAØ�}�}ˆ}Ø•V˜s•N�Ø—=‘= Ó#÷ ^×]×]Ó]ús   ÁAB8Â8C		)rC   rD   r=   r@   rB   rE   )r.   r/   r0   r1   r2   r%   Úfloat16r   r   rS   r<   r,   r3   r4   r5   r6   s   @@r   r8   r8   =   sX   ù‡ € ñð  ØØØØØØØØ—-‘-÷!!ðN ØØØ—.‘.ô%7÷N$÷ $ð $r   r8   )	Útypingr   r   r   r%   r   ÚModuler   r8   © r   r   Ú<module>rq      s6   ð÷$ (Ñ 'ã Ý ô"ˆb�i‰iô "ôJi$�"—)‘)ö i$r   