+
    åûjŸ  ã                   ó.   € ^ RI Ht ^ RIt ! R R4      tR# )é    )ÚUnionNc                   ó†   a € ] tR t^t o RtV 3R lR ltV 3R lR ltRV 3R lR llt]V 3R lR	 l4       t	V 3R
 lt
RtV tR# )ÚAverageMeteraõ  Keep the running average of a metric over batches.

``stats = AverageMeter()`` starts empty; ``stats.update(val, n)`` adds a value that stands for ``n`` samples, and
``stats.avg`` returns their ``n``-weighted mean as a Python float.

Convention:
    - ``update(val, n)`` adds ``val * n`` to ``sum`` and ``n`` to ``count``, so ``avg`` is the mean over
      samples when every ``val`` is a batch mean and ``n`` its batch size. ``val`` keeps the last value passed,
      unweighted.
    - Values are not rescaled: :func:`~kornia.metrics.accuracy` percentages average to a percentage. A tensor
      ``val`` keeps ``sum`` a tensor that holds its autograd graph; pass a detached tensor or a Python number to
      avoid keeping it.
    - Float16 and bfloat16 values are weighted and accumulated in float32. Later updates can promote the
      accumulator to a wider dtype; ``val`` always retains the original value and dtype.

See Also:
    - :func:`~kornia.metrics.accuracy`: a batch metric to feed it, as a percentage.

Example:
    >>> stats = AverageMeter()
    >>> acc1 = torch.tensor(99.0)  # top-1 accuracy of a batch in percent, as in K.metrics.accuracy(...)[0]
    >>> stats.update(acc1, n=1)  # where n is batch size usually
    >>> round(stats.avg, 2)
    99.0

c                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€ÚXC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\metrics\average_meter.pyÚ__annotate__ÚAverageMeter.__annotate__8   s   ø€ ÷ ñ ˜$ñ ó    c                ó&   € V P                  4        R # )N)Úreset©Úselfs   &r   Ú__init__ÚAverageMeter.__init__8   s   € Ø�
‰
Žr   c                ó   <€ V ^8„  d   QhRR/# r   r
   )r   r   s   "€r   r   r   ;   s   ø€ ÷ ñ �tñ r   c                ó>   € ^ V n         ^ V n        ^ V n        ^ V n        R# )z=Reset the current value, accumulated sum, count, and average.N)ÚvalÚ_avgÚsumÚcountr   s   &r   r   ÚAverageMeter.reset;   s   € àˆŒØˆŒ	ØˆŒØˆŽ
r   c                óX   <€ V ^8„  d   QhRS[ S[S[S[P                  3,          RS[RR/# )r   r   Únr	   N©r   ÚfloatÚboolÚtorchÚTensorÚint)r   r   s   "€r   r   r   B   s2   ø€ ÷ *ñ *™%¡¡t©U¯\©\Ð 9Õ:ð *¹sð *È4ñ *r   c                ó†  € Wn         \        V\        P                  4      '       d@   VP                  \        P
                  \        P                  39   d   VP                  4       MTpV P                  W2,          ,           V n        V ;P                  V,          un	        V P                  V P                  ,          V n
        R# )zÅAdd a new value to the running average.

Args:
    val: New scalar value or scalar tensor to accumulate.
    n: Weight for ``val``. This is usually the batch size represented
        by the value.
N)r   Ú
isinstancer#   r$   ÚdtypeÚfloat16Úbfloat16r!   r   r   r   )r   r   r   Úvalues   &&& r   ÚupdateÚAverageMeter.updateB   su   € ð ŒÜ)¨#¬u¯|©|×<Ò<ÀÇÁÌuÏ}É}Ô^c×^lÑ^lÐNmÔAm�—	‘	”ÐsvˆØ—8‘8˜e�iÕ'ˆŒØ�
Š
�a��
Ø—H‘H˜tŸz™zÕ)ˆŽ	r   c                ó    <€ V ^8„  d   QhRS[ /# )r   r	   )r!   )r   r   s   "€r   r   r   Q   s   ø€ ÷ ñ ‘Uñ r   c                ó´   € \        V P                  \        P                  4      '       d$   \	        V P                  P                  4       4      # V P                  # )z1Return the accumulated average as a Python float.)r'   r   r#   r$   r!   Úitemr   s   &r   ÚavgÚAverageMeter.avgP   s9   € ô �d—i‘i¤§¡×.Ò.Ü˜Ÿ™Ÿ™Ó)Ó*Ð*Ø�y‰yÐr   c                óÌ   <€ V ^8„  d   Qh/ S[ S[S[S[P                  3,          ;R&   S[ S[S[P                  3,          ;R&   S[ S[S[P                  3,          ;R&   S[;R&   # )r   r   r   r   r   r    )r   r   s   "€r   r   r      sd   ø‡ ‚ ñ8 
‰u‘d™EŸL™LÐ(Õ	)Ñ)ñ9 ñ: ‘‘u—|‘|Ð#Õ
$Ñ$ñ; ñ< 
‰u‘e—l‘lÐ"Õ	#Ñ#ñ= ñ> �Jò? r   )r   r   r   r   N)é   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r,   Úpropertyr1   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sE   ø‡ € ñ÷@ð ÷ð ÷*ò *ð ÷ó ð÷u ƒ r   r   )Útypingr   r#   r   r
   r   r   Ú<module>r?      s   ðõ$ ã ÷>ó >r   