+
    åûj+G  ã                   ó€  a € R t0 t ^ RIHtHtHtHtHt ^ RIt^ RIHt ^ RI	H
t
Ht / t] ^ k ]
! RR4      ]R&   ]
! RR4      ]R	&   RR
 R lltRR R llt ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      t ! R R]P                  4      tR# )é    )ÚCallableÚDictÚListÚOptionalÚTypeN)Únn)Úhf_urlÚload_state_dict_from_urlÚdefmozencoder_best.ptÚdefmo_encoderzrendering_best.ptÚdefmo_renderingc                ó\   € V ^8„  d   QhR\         R\         R\         R\        P                  /# )é   Ú	in_planesÚ
out_planesÚstrideÚreturn©Úintr   ÚConv2d)Úformats   "ÚPC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\feature\defmo.pyÚ__annotate__r   #   s2   € ÷ Vñ V”sð V¬ð V´Sð VÄÇÁñ Vó    c                ó6   € \         P                  ! W^VRR7      # )z1x1 convolution.F)Úkernel_sizer   Úbias©r   r   )r   r   r   s   &&&r   Úconv1x1r   #   s   € ä�9Š9�Y¸À&ÈuÔUÐUr   c                ót   € V ^8„  d   QhR\         R\         R\         R\         R\         R\        P                  /# )r   r   r   r   ÚgroupsÚdilationr   r   )r   s   "r   r   r   (   s>   € ÷ ñ ”sð ¬ð ´Sð Äcð ÔY\ð Ôeg×enÑenñ r   c                ó>   € \         P                  ! V V^VVVRVR7      # )z3x3 convolution with padding.F)r   r   Úpaddingr!   r   r"   r   )r   r   r   r!   r"   s   &&&&&r   Úconv3x3r%   (   s+   € ä�9Š9ØØØØØØØØô	ð 	r   c                   óh   a a€ ] tR t^6t oRt^tRV3R lV 3R llltV3R lR ltV3R ltRt	Vt
V ;t# )	Ú
Bottleneckaê  Implement the Bottleneck building block for ResNet.

This block follows the ResNet V1.5 design where the stride is applied to the 3x3 convolution
instead of the first 1x1 convolution to better preserve spatial information.

Args:
    inplanes: The number of input channels.
    planes: The number of intermediate channels.
    stride: The stride size for the convolution. Default: 1.
    downsample: An optional module to downsample the input identity. Default: None.
    groups: The number of blocked connections from input channels to output channels. Default: 1.
    base_width: The width of each group. Default: 64.
    dilation: The spacing between kernel elements. Default: 1.
    norm_layer: The normalization layer to use. Default: None.
c                óª   <€ V ^8„  d   QhRS[ RS[ RS[ RS[S[P                  ,          RS[ RS[ RS[ RS[S[R	S[P                  3,          ,          R
R/	# )r   ÚinplanesÚplanesr   Ú
downsampler!   Ú
base_widthr"   Ú
norm_layer.r   N)r   r   r   ÚModuler   )r   Ú__classdict__s   "€r   r   ÚBottleneck.__annotate__O   s€   ø€ ÷ ñ áðñ ðñ ð	ñ
 ™RŸY™YÕ'ðñ ðñ ðñ ðñ ™X c©2¯9©9 nÕ5Õ6ðð 
ñr   c	                óÎ  <€ \         S
V `  4        Vf   \        P                  p\	        W&R,          ,          4      V,          p	\        W4      V n        V! V	4      V n        \        W™W5V4      V n	        V! V	4      V n
        \        W’V P                  ,          4      V n        V! W P                  ,          4      V n        \        P                  ! RR7      V n        W@n        W0n        R # )Ng      P@T©Úinplace)ÚsuperÚ__init__r   ÚBatchNorm2dr   r   Úconv1Úbn1r%   Úconv2Úbn2Ú	expansionÚconv3Úbn3ÚReLUÚrelur+   r   )Úselfr)   r*   r   r+   r!   r,   r"   r-   ÚwidthÚ	__class__s   &&&&&&&&& €r   r5   ÚBottleneck.__init__O   s¬   ø€ ô 	‰ÑÔØÒÜŸ™ˆJÜ�F¨4Õ/Õ0Ó1°FÕ:ˆä˜XÓ-ˆŒ
Ù˜eÓ$ˆŒÜ˜U¨6¸8ÓDˆŒ
Ù˜eÓ$ˆŒÜ˜U¨T¯^©^Õ$;Ó<ˆŒ
Ù˜f§~¡~Õ5Ó6ˆŒÜ—G’G DÔ)ˆŒ	Ø$ŒØŽr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r   Úxr   ©ÚtorchÚTensor)r   r/   s   "€r   r   r0   i   s#   ø€ ÷ ñ ™Ÿ™ð ©%¯,©,ñ r   c                ó†  € TpV P                  V4      pV P                  V4      pV P                  V4      pV P                  V4      pV P	                  V4      pV P                  V4      pV P                  V4      pV P                  V4      pV P                  e   V P                  V4      pW2,          pV P                  V4      # )a  Run the bottleneck residual block.

Args:
    x: Feature tensor with shape ``(B, C, H, W)``, where ``B`` is batch
        size, ``C`` is channel count, and ``H``/``W`` are spatial dimensions.

Returns:
    Output feature tensor after the residual branch and identity connection.
)r7   r8   r?   r9   r:   r<   r=   r+   )r@   rF   ÚidentityÚouts   &&  r   ÚforwardÚBottleneck.forwardi   sž   € ð ˆà�j‰j˜‹mˆØ�h‰h�s‹mˆØ�i‰i˜‹nˆà�j‰j˜‹oˆØ�h‰h�s‹mˆØ�i‰i˜‹nˆà�j‰j˜‹oˆØ�h‰h�s‹mˆà�?‰?Ò&Ø—‘ qÓ)ˆHà�ˆØ�y‰y˜‹~Ðr   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r   r;   )r   )r   r/   s   "€r   r   r0   6   s   ø‡ ‚ ñ. Ñò/ r   )	r8   r:   r=   r7   r9   r<   r+   r?   r   )é   NrP   é@   rP   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r;   r5   rM   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__Ú__classcell__©rB   r/   s   @@r   r'   r'   6   s-   ù‡ € ñð, €I÷õ ÷4ð ÷g … r   r'   c                   ó€   a a€ ] tR t^‡t oRtRV3R lV 3R llltRV3R lR lltV3R lR ltV3R lR	 ltR
t	Vt
V ;t# )ÚResNeta+  Implement the ResNet architecture for feature extraction.

This implementation provides a flexible backbone used as the encoder in the DeFMO framework.

Args:
    block: The block type to use, typically :class:`Bottleneck`.
    layers: A list containing the number of blocks in each of the four stages.
    num_classes: The number of output classes. Default: 1000.
    zero_init_residual: Whether to initialize the last batch norm in each residual branch to zero. Default: False.
    groups: The number of groups for the convolution. Default: 1.
    width_per_group: The width of each group. Default: 64.
    replace_stride_with_dilation: A list of booleans indicating
        if stride should be replaced by dilation in each stage. Default: None.
    norm_layer: The normalization layer to use. Default: None.
c                óÆ   <€ V ^8„  d   QhRS[ S[,          RS[S[,          RS[RS[RS[RS[RS[S[S[,          ,          RS[S[R	S[P                  3,          ,          R
R/	# )r   ÚblockÚlayersÚnum_classesÚzero_init_residualr!   Úwidth_per_groupÚreplace_stride_with_dilationr-   .r   N)	r   r'   r   r   Úboolr   r   r   r.   )r   r/   s   "€r   r   ÚResNet.__annotate__˜   s‰   ø€ ÷ 47ñ 47á‘JÕð47ñ ‘S•	ð47ñ ð	47ñ
 !ð47ñ ð47ñ ð47ñ '/©t±D­zÕ&:ð47ñ ™X c©2¯9©9 nÕ5Õ6ð47ð 
ñ47r   c	           	     ó°  <€ \         S
V `  4        Vf   \        P                  pW€n        ^@V n        ^V n        Vf   . ROp\        V4      ^8w  d   \        RV 24      hWPn	        W`n
        \        P                  ! ^V P
                  ^^^RR7      V n        V! V P
                  4      V n        \        P                  ! RR7      V n        \        P                   ! ^^^R7      V n        V P%                  V^@V^ ,          4      V n        V P%                  V^€V^,          ^V^ ,          R7      V n        V P%                  VRV^,          ^V^,          R7      V n        V P%                  VR	V^,          ^V^,          R7      V n        \        P.                  ! R4      V n        \        P2                  ! R	VP4                  ,          V4      V n        V P9                  4        F×  p	\;        V	\        P                  4      '       d/   \        P<                  P?                  V	P@                  R
RR7       KQ  \;        V	\        P                  \        PB                  34      '       g   Kƒ  \        P<                  PE                  V	P@                  ^4       \        P<                  PE                  V	PF                  ^ 4       KÙ  	  V'       dœ   V P9                  4        F…  p	\;        V	\H        4      '       g   K  \;        V	PJ                  P@                  \L        PN                  4      '       g   KQ  \        P<                  PE                  V	PJ                  P@                  ^ 4       K‡  	  R # R # )NFzFreplace_stride_with_dilation should be None or a 3-element tuple, got ©r   r   r$   r   Tr2   )r   r   r$   )r   Údilateé   i   Úfan_outr?   )ÚmodeÚnonlinearity)FFF)rP   rP   )(r4   r5   r   r6   Ú_norm_layerr)   r"   ÚlenÚ
ValueErrorr!   r,   r   r7   r8   r>   r?   Ú	MaxPool2dÚmaxpoolÚ_make_layerÚlayer1Úlayer2Úlayer3Úlayer4ÚAdaptiveAvgPool2dÚavgpoolÚLinearr;   ÚfcÚmodulesÚ
isinstanceÚinitÚkaiming_normal_ÚweightÚ	GroupNormÚ	constant_r   r'   r=   rH   rI   )r@   r_   r`   ra   rb   r!   rc   rd   r-   ÚmrB   s   &&&&&&&&& €r   r5   ÚResNet.__init__˜   sk  ø€ ô 	‰ÑÔØÒÜŸ™ˆJØ%ÔàˆŒØˆŒØ'Ò/ò ,AÐ(ÜÐ+Ó,°Ô1ÜØXÐYuÐXvÐwóð ð ŒØ)ŒÜ—Y’Y˜q $§-¡-¸QÀqÐRSÐZ_Ô`ˆŒ
Ù˜dŸm™mÓ,ˆŒÜ—G’G DÔ)ˆŒ	Ü—|’|°¸!ÀQÔGˆŒØ×&Ñ& u¨b°&¸µ)Ó<ˆŒØ×&Ñ& u¨c°6¸!µ9ÀQÐOkÐlmÕOnÐ&ÓoˆŒØ×&Ñ& u¨c°6¸!µ9ÀQÐOkÐlmÕOnÐ&ÓoˆŒØ×&Ñ& u¨c°6¸!µ9ÀQÐOkÐlmÕOnÐ&ÓoˆŒÜ×+Ò+¨FÓ3ˆŒÜ—)’)˜C %§/¡/Õ1°;Ó?ˆŒà—‘–ˆAÜ˜!œRŸY™Y×'Ò'Ü—‘×'Ñ'¨¯©°yÈvÐ'ÖVÜ˜A¤§¡´·±Ð=×>Ô>Ü—‘×!Ñ! !§(¡(¨AÔ.Ü—‘×!Ñ! !§&¡&¨!Ö,ñ  ÷ Ø—\‘\–^�Ü˜a¤×,Ô,´¸A¿E¹E¿L¹LÌ%Ï,É,×1WÔ1WÜ—G‘G×%Ñ% a§e¡e§l¡l°AÖ6ó $ñ r   c                ób   <€ V ^8„  d   QhRS[ S[,          RS[RS[RS[RS[RS[P
                  /# )r   r_   r*   Úblocksr   ri   r   )r   r'   r   re   r   Ú
Sequential)r   r/   s   "€r   r   rf   Î   sF   ø€ ÷ !&ñ !&Ù™*Õ%ð!&Ù/2ð!&Ù<?ð!&ÙILð!&ÙZ^ð!&á	�‰ñ!&r   c                óì  € V P                   pR pV P                  pV'       d   V ;P                  V,          un        ^pV^8w  g"   V P                  W!P                  ,          8w  dS   \        P
                  ! \        V P                  W!P                  ,          V4      V! W!P                  ,          4      4      p. p	V	P                  V! V P                  W$WpP                  V P                  W†4      4       W!P                  ,          V n        \        ^V4       FH  p
V	P                  V! V P                  VV P                  V P                  V P                  VR7      4       KJ  	  \        P
                  ! V	!  # )N)r!   r,   r"   r-   )rn   r"   r)   r;   r   r‡   r   Úappendr!   r,   Úrange)r@   r_   r*   r†   r   ri   r-   r+   Úprevious_dilationr`   Ú_s   &&&&&&     r   rs   ÚResNet._make_layerÎ   s  € ð ×%Ñ%ˆ
Øˆ
Ø ŸM™MÐßØ�MŠM˜VÕ#�MØˆFØ�QŒ;˜$Ÿ-™-¨6·O±OÕ+CÔCÜŸšÜ˜Ÿ™ v·±Õ'?ÀÓHÉ*ÐU[×^mÑ^mÕUmÓJnóˆJð ˆØ�‰ÙØ—‘˜v¨z¿;¹;ÈÏÉÐYjóô	
ð
 §¡Õ0ˆŒÜ�q˜&Ö!ˆAØ�M‰MÙØ—M‘MØØŸ;™;Ø#Ÿ™Ø!Ÿ]™]Ø)ôö	ñ "ô �}Š}˜fÑ%Ð%r   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rE   rG   )r   r/   s   "€r   r   rf   ñ   s#   ø€ ÷ ñ ™uŸ|™|ð ±·±ñ r   c                ó„  € V P                  V4      pV P                  V4      pV P                  V4      pV P                  V4      pV P	                  V4      pV P                  V4      pV P                  V4      pV P                  V4      pV P                  V4      p\        P                  ! V^4      pV P                  V4      # ©rP   )r7   r8   r?   rr   rt   ru   rv   rw   ry   rH   Úflattenr{   ©r@   rF   s   &&r   Ú_forward_implÚResNet._forward_implñ   s•   € à�J‰J�q‹MˆØ�H‰H�Q‹KˆØ�I‰I�a‹LˆØ�L‰L˜‹Oˆà�K‰K˜‹NˆØ�K‰K˜‹NˆØ�K‰K˜‹NˆØ�K‰K˜‹Nˆà�L‰L˜‹OˆÜ�MŠM˜!˜QÓˆØ�w‰w�q‹zÐr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rE   rG   )r   r/   s   "€r   r   rf     s#   ø€ ÷ 	%ñ 	%™Ÿ™ð 	%©%¯,©,ñ 	%r   c                ó$   € V P                  V4      # )zÆRun the ResNet backbone and classification head.

Args:
    x: Input image or feature tensor with shape ``(B, C, H, W)``.

Returns:
    Tensor with shape ``(B, N)``, where ``N`` is ``num_classes``.
)r“   r’   s   &&r   rM   ÚResNet.forward  s   € ð ×!Ñ! !Ó$Ð$r   )rn   ry   r,   r8   r7   r"   r{   r!   r)   rt   ru   rv   rw   rr   r?   )iè  FrP   rQ   NN)rP   F)rR   rS   rT   rU   rV   r5   rs   r“   rM   rX   rY   rZ   r[   s   @@r   r]   r]   ‡   s9   ù‡ € ñ÷ 47õ 47÷l!&ò !&÷Fð ÷ 	%÷ 	%ð 	%r   r]   c                   óT   a a€ ] tR tR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	# )ÚEncoderDeFMOi  aÃ  Implement the Encoder module for the Deblurring Fast Moving Objects (DeFMO) model.

The encoder extracts latent features from the concatenation of the blurred input image and
the estimated background. It uses a modified ResNet-50 backbone to accept 6-channel inputs.


Shape:
    - Input: (B, 6, H, W) where 6 represents the concatenated blurred image and background.
    - Output: A list of feature maps from different stages of the ResNet backbone.
c                ó   <€ V ^8„  d   QhRR/# ©r   r   N© )r   r/   s   "€r   r   ÚEncoderDeFMO.__annotate__  s   ø€ ÷ 3ñ 3˜$ñ 3r   c           	     ó„  <€ \         SV `  4        \        \        . RO4      p\        P
                  ! \        VP                  4       4      R,          !  p\        P
                  ! \        VP                  4       4      R,          !  p\        P                  ! ^^@RRR	RR7      V^ &   \        P
                  ! W#4      V n	        R# )
é   :NrŸ   N:é   é   NFrh   N)rŸ   r    é   rŸ   )é   r£   )r   r   )rŸ   rŸ   )
r4   r5   r]   r'   r   r‡   ÚlistÚchildrenr   Únet)r@   ÚmodelÚmodelc1Úmodelc2rB   s   &   €r   r5   ÚEncoderDeFMO.__init__  s†   ø€ Ü‰ÑÔÜ”z¢<Ó0ˆÜ—-’-¤ e§n¡nÓ&6Ó!7¸Õ!;Ñ<ˆÜ—-’-¤ e§n¡nÓ&6Ó!7¸Õ!<Ñ=ˆÜ—Y’Y˜q "°&ÀÐQWÐ^cÔdˆ�‰
Ü—=’= Ó2ˆŽr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r   Ú
input_datar   rG   )r   r/   s   "€r   r   r�   !  s#   ø€ ÷ 
$ñ 
$¡%§,¡,ð 
$±5·<±<ñ 
$r   c                ó$   € V P                  V4      # )a#  Encode blurred-image and background inputs into latent features.

Args:
    input_data: Tensor with shape ``(B, 6, H, W)``. The 6 channels usually
        concatenate RGB blurred input and RGB background estimate.

Returns:
    Latent feature tensor produced by the modified ResNet encoder.
©r¦   )r@   r­   s   &&r   rM   ÚEncoderDeFMO.forward!  s   € ð �x‰x˜
Ó#Ð#r   r¯   ©
rR   rS   rT   rU   rV   r5   rM   rX   rY   rZ   r[   s   @@r   r™   r™     s#   ù‡ € ñ	÷3ó 3÷
$÷ 
$ð 
$r   r™   c                   óT   a a€ ] tR tR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	# )ÚRenderingDeFMOi.  a»  Implement the Rendering module for the Deblurring Fast Moving Objects (DeFMO) model.

This module acts as a decoder that transforms the latent features from the encoder into
a temporal sequence of sharp sub-frames, recovering the object's appearance and motion.

Shape:
    - Input: Latent feature representation from the :class:`EncoderDeFMO`.
    - Output: (B, T, 4, H, W) where T is the number of sub-frames and 4 represents RGBA channels.
c                ó   <€ V ^8„  d   QhRR/# r›   rœ   )r   r/   s   "€r   r   ÚRenderingDeFMO.__annotate__9  s   ø€ ÷ ^ñ ^˜$ñ ^r   c                ó  <€ \         SV `  4        ^V n        \        P                  ! \        P
                  ! RR^^^RR7      \        P                  ! RRRRRR7      \        P                  ! RR	7      \        RR
4      \        P                  ! ^4      \        R
^@4      \        P                  ! ^4      \        ^@^4      \        P                  ! ^4      \        P
                  ! ^^^^^RR7      \        P                  ! ^4      \        P
                  ! ^^^^^RR7      \        P                  ! RR	7      \        P
                  ! ^^^^^RR7      4      pWn
        V P                  R\        P                  ! ^ ^V P                  4      RR7       R# )é   i  i   Frh   gñhãˆµøä>gš™™™™™¹?T)ÚepsÚmomentumÚaffineÚtrack_running_statsr2   rj   Útimes)Ú
persistentN)r4   r5   Ú	tsr_stepsr   r‡   r   r6   r>   r'   ÚPixelShuffler¦   Úregister_bufferrH   Úlinspace)r@   r§   rB   s   & €r   r5   ÚRenderingDeFMO.__init__9  s&  ø€ Ü‰ÑÔØ ˆŒÜ—’Ü�IŠI�d˜D¨a¸À1È5ÔQÜ�NŠN˜4 U°SÀÐ[_Ô`Ü�GŠG˜DÔ!Ü�t˜SÓ!Ü�OŠO˜AÓÜ�s˜BÓÜ�OŠO˜AÓÜ�r˜2ÓÜ�OŠO˜AÓÜ�IŠI�b˜"¨!°A¸qÀuÔMÜ�OŠO˜AÓÜ�IŠI�a˜¨°!¸QÀTÔJÜ�GŠG˜DÔ!Ü�IŠI�a˜¨°!¸QÀTÔJó
ˆð  Œð 	×Ñ˜W¤e§n¢n°Q¸¸4¿>¹>Ó&JÐW\ÐÖ]r   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# )r   Úlatentr   rG   )r   r/   s   "€r   r   rµ   T  s#   ø€ ÷ ñ ™eŸl™lð ©u¯|©|ñ r   c                ó.  € V P                   P                  VP                  VP                  R7      P	                  ^ 4      P                  VP                  ^ ,          ^4      p. p\        VP                  ^,          4       FÌ  pV\        \        VP                  ^ ,          4      4      V3,          P	                  R4      P	                  R4      P	                  R4      P                  ^^VP                  ^,          VP                  ^,          4      p\        P                  ! WQ3^4      pV P                  V4      pVP                  V4       KÎ  	  \        P                  ! V^4      P                  4       p\        P                  ! VR,          4      VR&   V# )a7  Render a temporal RGBA sequence from latent DeFMO features.

Args:
    latent: Latent feature tensor from :class:`EncoderDeFMO` with shape
        ``(B, C, H, W)``.

Returns:
    Tensor with shape ``(B, T, 4, H_out, W_out)``, where ``T`` is the
    number of rendered time steps and 4 represents RGBA channels.
)ÚdtypeÚdeviceéÿÿÿÿ)ºNNNrÉ   :Nr    N)r¼   ÚtorÆ   rÇ   Ú	unsqueezeÚrepeatÚshaperŠ   r¤   rH   Úcatr¦   r‰   ÚstackÚ
contiguousÚsigmoid)	r@   rÄ   r¼   ÚrendersÚkiÚt_tensorÚlatentiÚresultÚrenders_stackeds	   &&       r   rM   ÚRenderingDeFMO.forwardT  s,  € ð —
‘
—‘ F§L¡L¸¿¹�ÓG×QÑQÐRSÓT×[Ñ[Ð\b×\hÑ\hÐijÕ\kÐmnÓoˆØˆÜ˜Ÿ™ A�Ö'ˆBà”dœ5 §¡¨Q¥Ó0Ó1°2Ð5Õ6ß‘˜2“ß‘˜2“ß‘˜2“ß‘˜˜1˜fŸl™l¨1�o¨v¯|©|¸A­Ó?ð ô —i’i Ð 2°AÓ6ˆGØ—X‘X˜gÓ&ˆFØ�N‰N˜6Ö"ñ (ô  Ÿ+š+ g¨qÓ1×<Ñ<Ó>ˆÜ$)§M¢M°/À(Õ2KÓ$Lˆ˜Ñ!ØÐr   )r¦   r¾   r±   r[   s   @@r   r³   r³   .  s%   ù‡ € ñ÷^ó ^÷6÷ ð r   r³   c                   óX   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RtVtV ;t	# )	ÚDeFMOit  a7  Deblur a fast-moving object into 24 RGBA sub-frames of the object alone (DeFMO).

``defmo = DeFMO()`` builds the network with its pretrained weights, in eval mode, and ``frames = defmo(x)`` takes
``(B, 6, H, W)`` inputs, each a blurred RGB image followed by an RGB estimate of its background, and returns
``(B, 24, 4, H, W)``, with ``H`` and ``W`` rounded up to multiples of 16: the object at 24 instants in time order,
each an RGBA image whose alpha channel separates it from the background, which is not rendered. It is an image
model, not a local feature: it detects and describes nothing. This is based on the original code from paper
"DeFMO: Deblurring and Shape Recovery of Fast Moving Objects". See :cite:`DeFMO2021` for more details.

Convention:
    - The input is ``(B, 6, H, W)``: the RGB channels of the blurred image, then those of the background
      estimate, in :math:`[0, 1]` for the pretrained weights. ``H`` and ``W`` that are multiples of 16 give an
      output of the same size; other sizes give an output rounded up to the next multiples of 16.
    - The output is ``(B, 24, 4, H, W)``: 24 sub-frames in time order, sub-frame ``k`` rendered at the time
      ``k / 23``, each with red, green, blue and alpha channels in :math:`[0, 1]` after a sigmoid.

Args:
    pretrained: Download and set pretrained weights to the model, and return it in eval mode. Default: True.
        With ``False`` the weights are random and the model is in training mode.

Returns:
    Temporal super-resolution without background.

Shape:
    - Input: ``(B, 6, H, W)``
    - Output: ``(B, 24, 4, H, W)``, with ``H`` and ``W`` rounded up to multiples of 16

Examples:
    >>> import kornia
    >>> input = torch.rand(2, 6, 240, 320)
    >>> defmo = kornia.feature.DeFMO(pretrained=False).eval()
    >>> tsr_nobgr = defmo(input) # 2x24x4x240x320

c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Ú
pretrainedr   N)re   )r   r/   s   "€r   r   ÚDeFMO.__annotate__˜  s   ø€ ÷ ñ ¡4ð °4ñ r   c                ó¸  <€ \         SV `  4        \        4       V n        \	        4       V n        V'       d¥   \        \        R ,          \        P                  ! R4      R7      pV P                  P                  VRR7       \        \        R,          \        P                  ! R4      R7      pV P
                  P                  VRR7       V P                  4        R# R# )r   Úcpu)Úmap_locationT)Ústrictr   N)r4   r5   r™   Úencoderr³   Ú	renderingr
   ÚurlsrH   rÇ   Úload_state_dictÚeval)r@   rÜ   Úpretrained_dictÚpretrained_dict_renrB   s   &&  €r   r5   ÚDeFMO.__init__˜  s¡   ø€ Ü‰ÑÔÜ#“~ˆŒÜ'Ó)ˆŒ÷ Ü6´t¸OÕ7LÔ[`×[gÒ[gÐhmÓ[nÔoˆOØ�L‰L×(Ñ(¨ÀÐ(ÔFÜ":¼4Ð@QÕ;RÔaf×amÒamÐnsÓatÔ"uÐØ�N‰N×*Ñ*Ð+>ÀtÐ*ÔLØ�I‰IŽKñ r   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# r¬   rG   )r   r/   s   "€r   r   rÝ   ¥  s#   ø€ ÷ &ñ &¡%§,¡,ð &±5·<±<ñ &r   c                óF   € V P                  V4      pV P                  V4      # )as  Deblur a fast-moving object into a sequence of RGBA sub-frames.

Args:
    input_data: Tensor with shape ``(B, 6, H, W)`` containing the blurred
        RGB image concatenated with an RGB background estimate.

Returns:
    Tensor with shape ``(B, T, 4, H, W)``, where ``T`` is the number of
    temporal sub-frames, 24, and 4 stores red, green, blue, and alpha channels.
©râ   rã   )r@   r­   rÄ   s   && r   rM   ÚDeFMO.forward¥  s!   € ð —‘˜jÓ)ˆØ�~‰~˜fÓ%Ð%r   rì   )Tr±   r[   s   @@r   rÚ   rÚ   t  s$   ù‡ € ñ!÷Fõ ÷&÷ &ð &r   rÚ   c                óŽ   € V ^8„  d   Qh/ ^ \         9   d1   \        \        \        \        \        ,          ,          3,          ;R&   # )r   rä   )Ú__conditional_annotations__r   Ústrr¤   )r   s   "r   r   r      s,   € × 7Ñ 7÷ &Ò %„dŒ3””dœ3•i•ÐÕ Ñ %ò 8r   r�   )rP   rP   rP   )rï   Útypingr   r   r   r   r   rH   r   Úkornia.core.downloadr	   r
   rä   r   r%   r.   r'   r]   r™   r³   rÚ   r   )rï   s   @r   Ú<module>ró      s®   øð÷$ 8× 7Ò 7ã Ý ç Að $&€Ó %Ù˜wÐ(9Ó:€€_Ñ Ù  Ð*=Ó>€ÐÑ ÷V÷
ôN�—‘ô NôbC%ˆR�Y‰Yô C%ôL$�2—9‘9ô $ôBC�R—Y‘Yô CôL=&ˆB�I‰Iö =&r   