+
    åûjh  ã                  ój   € ^ RI Ht ^ RIt^ RIHtHt ^ RIt^ RIHtH	t	H
t
HtHt R R ltR	R R lltR# )
é    )ÚannotationsN)ÚAnyÚTuple)ÚKORNIA_CHECKÚKORNIA_CHECK_IS_TENSORÚKORNIA_CHECK_SAME_DEVICEÚKORNIA_CHECK_SHAPEÚKORNIA_CHECK_SIZESc               ó    € V ^8„  d   QhRRRR/# )é   Úkr   ÚreturnÚbool© )Úformats   "ÚSC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\kornia\metrics\accuracy.pyÚ__annotate__r   "   s   € ÷ ñ ˜#ð  $ñ ó    c                ó  € \        V \        4      '       g@   \        V \        P                  4      '       d"   V P                  \        P                  8X  d   R#  \
        P                  ! V 4      ^ 8„  #   \        \        3 d     R# i ; i)zgReturn whether ``k`` is a positive integer; NumPy integers and 0-d integer tensors count, bools do not.F)	Ú
isinstancer   ÚtorchÚTensorÚdtypeÚoperatorÚindexÚ	TypeErrorÚ
ValueError)r   s   &r   Ú_is_positive_indexr   "   sa   € ä�!”T×Òœz¨!¬U¯\©\×:Ò:¸q¿w¹wÌ%Ï*É*Ô?TÙðÜ�~Š~˜aÓ  1Ñ$Ð$øÜ”zÐ"ô Úðús   ÁA2 Á2BÂBc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úpredztorch.TensorÚtargetÚtopkzTuple[int, ...]r   zlist[torch.Tensor]r   )r   s   "r   r   r   ,   s/   € ÷ .cñ .c�<ð .c¨ð .c¸_ð .cÐXjñ .cr   c           	     óR  € \        V 4       \        V4       \        W4       \        V RR.4       \        WP                  ^ ,          .^.VP
                  ^,
          ,          O4       \        \        V4      ^ 8„  ;'       d5    \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      R4       \        \        V4      V P                  4       ^,          4      pVP                  ^ 4      pV P                  V^RR4      w  rPV P                  4       p V P                  VP                  ^R	4      P!                  V 4      4      pV Uu. uFJ  qvR\        Ws4       P                  R	4      P#                  4       P%                  ^ 4      R,          V,          NKL  	  up# u upi )
a£  Compute the top-k classification accuracy of class scores, in percent.

``accs = accuracy(pred, target, topk=(1, 5))`` takes ``(B, C)`` class scores and ``(B,)`` class indices, and
returns one percentage in :math:`[0, 100]`, not a fraction, per entry of ``topk``.

Convention:
    - Only the order of the scores in a row matters. A sample counts for ``k`` when its target is among its
      ``k`` highest scores; a ``k`` above :math:`C` counts as :math:`C`. :ref:`Losses and metrics
      <losses-metrics-conventions>` lists the scale of every task metric.

Args:
    pred: class scores with shape ``(B, C)``.
    target: ground-truth class indices with shape ``(B,)`` or ``(B, 1)``.
    topk: the values of ``k``, positive integers.

Returns:
    a list with one 0-d float32 tensor per entry of ``topk``, in that order.

See Also:
    - :func:`~kornia.metrics.confusion_matrix`: counts of every target and predicted class pair, from hard labels.
    - :class:`~kornia.metrics.AverageMeter`: the running mean of these percentages over batches.

Example:
    >>> logits = torch.tensor([[0, 1, 0]])
    >>> target = torch.tensor([[1]])
    >>> accuracy(logits, target)
    [tensor(100.)]

ÚBÚCc              3  ó8   "  € T F  p\        V4      x € K  	  R # 5i)N)r   )Ú.0r   s   & r   Ú	<genexpr>Úaccuracy.<locals>.<genexpr>Q   s   é € ÐB¹T¸Ô0°×3Ð3»Tùs   ‚FTz6topk must be a non-empty sequence of positive integersNg      Y@éÿÿÿÿ)r   r   r	   r
   ÚshapeÚndimr   ÚlenÚallÚminÚmaxÚsizer"   ÚtÚeqÚreshapeÚ	expand_asÚfloatÚsum)r    r!   r"   ÚmaxkÚ
batch_sizeÚ_Úcorrectr   s   &&&     r   Úaccuracyr<   ,   sH  € ô< ˜4Ô Ü˜6Ô"Ü˜TÔ*Ü�t˜c 3˜ZÔ(ä�v§
¡
¨1¥ÐJ°!°¸¿¹Àa½Õ1HÐJÔKÜÜˆD‹	�A‰×BÐBŸ#›#ÑB¹TÓBŸ#Ÿ#š#ÑB¹TÓBÓBØ@ôô
 Œs�4‹y˜$Ÿ)™)›+ a�.Ó)€DØ—‘˜Q“€JØ�i‰i˜˜a  tÓ,�G€AØ�6‰6‹8€DØ�g‰g�f—n‘n Q¨Ó+×5Ñ5°dÓ;Ó<€GÙ]aÓbÑ]aÐXY�N”c˜!“lÐ#×+Ñ+¨BÓ/×5Ñ5Ó7×;Ñ;¸AÓ>ÀÕFÈ×SÐSÑ]aÑbÐbùÒbs   ÅAF$))é   )Ú
__future__r   r   Útypingr   r   r   Úkornia.core.checkr   r   r   r	   r
   r   r<   r   r   r   Ú<module>rA      s.   ðõ$ #ã ß ã ÷õ õ÷.cñ .cr   