+
    åûjö  ã                   óª   € ^ RI HtHt ^ RIt^ RIHt ^ RIHtHt RR R lltR R lt	 ! R	 R
]P                  4      t ! R R]P                  4      tR# )é    )ÚOptionalÚTupleN)Únn)ÚKORNIA_CHECKÚKORNIA_CHECK_SHAPEc                ó”   € V ^8„  d   QhR\         P                  R\        \        \        R3,          ,          R\         P                  /# )é   ÚinputÚdim.Úreturn)ÚtorchÚTensorr   r   Úint)Úformats   "ÚSC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\enhance\integral.pyÚ__annotate__r      s9   € ÷ 4ñ 4œ5Ÿ<™<ð 4¬h´u¼SÀ#¸XµÕ.Gð 4ÔSX×S_ÑS_ñ 4ó    c                ó.  a € \        S RR.4       Vf   Rp\        \        V4      ^ 8„  R4       \        \        V4      \        S P                  4      8*  R4       \        ;QJ d    . V 3R lV 4       F  NK  	  5M! V 3R lV 4       4      p\        \
        ;QJ d    V 3R lV 4       F  '       d   K   RM	  RM! V 3R lV 4       4      R	4       \        \        \        V4      4      \        V4      8H  R
4       S pV F  pVP                  V4      pK  	  V# )aç  Sum a tensor cumulatively along chosen axes.

``out = integral_tensor(input, dim)`` takes the inclusive cumulative sum of ``input`` along each axis in ``dim``.
For ``dim=(-2, -1)``, ``out[..., i, j]`` is the sum of ``input[..., :i + 1, :j + 1]``.

Convention:
    - ``dim`` is a non-empty tuple of unique axes; an ``int`` raises ``TypeError``.
    - There is no zero row or column in front, so ``cv2.integral(x)[1:, 1:]`` equals the result for the two
      spatial axes.

Args:
    input: tensor with shape ``(*, D)``, one axis or more.
    dim: axes to sum along. The default is the last axis.

Returns:
    Cumulative sums with the shape of ``input``.

See Also:
    - :func:`integral_image`: sums the two spatial axes.
    - :class:`IntegralTensor`: the module form.

Examples:
    >>> input = torch.ones(3, 5)
    >>> output = integral_tensor(input, (-2, -1))
    >>> output
    tensor([[ 1.,  2.,  3.,  4.,  5.],
            [ 2.,  4.,  6.,  8., 10.],
            [ 3.,  6.,  9., 12., 15.]])

Ú*ÚDzdim must be a non-empty tuple.z-dim must be a tuple of length <= input.shape.c              3   óZ   <"  € T F   q^ 8¼  d   TMVSP                   ,           x € K"  	  R# 5i©r   N©Úndim©Ú.0Údr
   s   & €r   Ú	<genexpr>Ú"integral_tensor.<locals>.<genexpr>A   s"   øé € ÐHÁC¸q Q¤™1¨A°·
±
­NÔ:ÃCùs   ƒ(+c              3   ód   <"  € T F%  p^ Tu;8*  ;'       d    SP                   8  Mu x € K'  	  R# 5ir   r   r   s   & €r   r   r   C   s%   øé € Ð8© AˆA�×Ô�U—Z‘Z×Ñ«ùs   ƒ0–0FTz0dim must contain valid dimensions for the input.z#dim must contain unique dimensions.)éÿÿÿÿ)r   r   ÚlenÚshapeÚtupleÚallÚsetÚcumsum)r
   r   Únormalized_dimÚoutputÚis   f&   r   Úintegral_tensorr+      sÜ   ø€ ô> �u˜s C˜jÔ)à
‚{Øˆä”�S“˜A‘Ð?Ô@Ü”�S“œS §¡Ó-Ñ-Ð/^Ô_ç”UÔHÁCÓH—U‘UÔHÁCÓHÓH€NÜß‹Ô8©Ó8��ŠÔ8©Ó8Ó8Ø:ôô ÜŒC�ÓÓ ¤C¨Ó$7Ñ7Ø-ôð
 €FÛˆØ—‘˜qÓ!Šñ à€Mr   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r	   Úimager   ©r   r   )r   s   "r   r   r   Q   s"   € ÷ !,ñ !,œ%Ÿ,™,ð !,¬5¯<©<ñ !,r   c                ó6   € \        V . RO4       \        V R4      # )aM  Sum an image cumulatively along its rows and columns.

``out = integral_image(image)`` returns the integral image of ``image``: ``out[..., i, j]`` is the sum of
``image[..., :i + 1, :j + 1]``.

Convention:
    There is no zero row or column in front, unlike ``cv2.integral``, whose result is larger by one row and
    column.

Args:
    image: image with shape ``(*, H, W)``.

Returns:
    Integral image with shape ``(*, H, W)``.

See Also:
    - :func:`integral_tensor`: sums along any axes.
    - :class:`IntegralImage`: the module form.

Examples:
    >>> input = torch.ones(1, 5, 5)
    >>> output = integral_image(input)
    >>> output
    tensor([[[ 1.,  2.,  3.,  4.,  5.],
             [ 2.,  4.,  6.,  8., 10.],
             [ 3.,  6.,  9., 12., 15.],
             [ 4.,  8., 12., 16., 20.],
             [ 5., 10., 15., 20., 25.]]])

)r   ÚHÚW)éþÿÿÿr!   )r   r+   )r-   s   &r   Úintegral_imager3   Q   s   € ô> �ušoÔ.ä˜5 (Ó+Ð+r   c                   óX   a a€ ] tR t^ut 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	# )ÚIntegralTensoraß  Sum a tensor cumulatively along chosen axes (module form).

``op = IntegralTensor(dim)`` stores ``dim`` and ``out = op(input)`` is :func:`integral_tensor` with it.

Convention:
    - See the convention block of :func:`integral_tensor`.

Args:
    dim: axes to sum along. The default is the last axis.

Shape:
    - Input: ``(*, D)``
    - Output: same shape as the input.

See Also:
    - :func:`integral_tensor`: the one-call form.
    - :class:`IntegralImage`: sums the two spatial axes.

Examples:
    >>> input = torch.ones(3, 5)
    >>> dim = (-2, -1)
    >>> output = IntegralTensor(dim)(input)
    >>> output
    tensor([[ 1.,  2.,  3.,  4.,  5.],
            [ 2.,  4.,  6.,  8., 10.],
            [ 3.,  6.,  9., 12., 15.]])

c                óH   <€ V ^8„  d   QhRS[ S[S[R3,          ,          RR/# )r	   r   .r   N)r   r   r   )r   Ú__classdict__s   "€r   r   ÚIntegralTensor.__annotate__“   s(   ø€ ÷ ñ ™H¡U©3°¨8¥_Õ5ð Àñ r   c                ó0   <€ \         SV `  4        Wn        R # ©N)ÚsuperÚ__init__r   )Úselfr   Ú	__class__s   &&€r   r<   ÚIntegralTensor.__init__“   s   ø€ Ü‰ÑÔØŽr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r	   r
   r   r.   )r   r7   s   "€r   r   r8   —   s#   ø€ ÷ 0ñ 0™UŸ\™\ð 0©e¯l©lñ 0r   c                ó,   € \        WP                  4      # )a•  Compute cumulative sums of the input tensor along configured axes.

Args:
    input: Tensor to integrate. The operation supports arbitrary rank,
        and dimensions are accumulated according to ``self.dim``.

Returns:
    A tensor with the same shape as ``input`` containing cumulative
    sums. If ``self.dim`` is ``None``, integration is applied to the
    last dimension by :func:`integral_tensor`.
)r+   r   ©r=   r
   s   &&r   ÚforwardÚIntegralTensor.forward—   s   € ô ˜u§h¡hÓ/Ð/r   )r   r:   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r<   rD   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r>   r7   s   @@r   r5   r5   u   s#   ù‡ € ñ÷:õ ÷0÷ 0ð 0r   r5   c                   ó6   a € ] tR t^¦t o RtV 3R lR ltRtV tR# )ÚIntegralImagea³  Sum an image cumulatively along its rows and columns (module form).

``out = IntegralImage()(image)`` is :func:`integral_image`.

Convention:
    - See the convention block of :func:`integral_image`.

Shape:
    - Input: ``(*, H, W)``
    - Output: same shape as the input.

See Also:
    - :func:`integral_image`: the one-call form.
    - :class:`IntegralTensor`: sums along any axes.

Examples:
    >>> input = torch.ones(1, 5, 5)
    >>> output = IntegralImage()(input)
    >>> output
    tensor([[[ 1.,  2.,  3.,  4.,  5.],
             [ 2.,  4.,  6.,  8., 10.],
             [ 3.,  6.,  9., 12., 15.],
             [ 4.,  8., 12., 16., 20.],
             [ 5., 10., 15., 20., 25.]]])

c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# rA   r.   )r   r7   s   "€r   r   ÚIntegralImage.__annotate__Â   s#   ø€ ÷ %ñ %™UŸ\™\ð %©e¯l©lñ %r   c                ó   € \        V4      # )aR  Compute a 2D integral image by summing over height and width.

Args:
    input: Tensor whose last two dimensions represent spatial axes,
        typically shaped ``(*, H, W)``.

Returns:
    A tensor of the same shape as ``input`` where each location stores
    the cumulative sum over the top-left rectangle ending at that
    location.
)r3   rC   s   &&r   rD   ÚIntegralImage.forwardÂ   s   € ô ˜eÓ$Ð$r   © N)rF   rG   rH   rI   rJ   rD   rK   rL   )r7   s   @r   rO   rO   ¦   s   ø‡ € ñ÷6%ö %r   rO   r:   )Útypingr   r   r   r   Úkornia.core.checkr   r   r+   r3   ÚModuler5   rO   rT   r   r   Ú<module>rX      s@   ð÷$ #ã Ý ç >÷4õn!,ôH.0�R—Y‘Yô .0ôb(%�B—I‘Iö (%r   