
    3j              
           S SK JrJr  S SKrS	S\R                  S\R                  S\\S4   S\\R                     4S jjrg)
    )ListTupleNpredtargettopk.returnc           	         [        [        U5      U R                  5       S   5      nUR                  S5      nU R                  USSS5      u  pPU R	                  5       n U R                  UR                  SS5      R                  U 5      5      nU Vs/ s HB  ovS[        Xs5       R                  S5      R                  5       R                  S5      S-  U-  PMD     sn$ s  snf )a  Compute the accuracy over the k top predictions for the specified values of k.

Args:
    pred: the input torch.Tensor with the logits to evaluate.
    target: the torch.Tensor containing the ground truth.
    topk: the expected topk ranking.

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

   r   TNg      Y@)
minmaxsizer   teqreshape	expand_asfloatsum)r   r   r   maxk
batch_size_correctks           Q/home/wildlama/miniconda3/lib/python3.13/site-packages/kornia/metrics/accuracy.pyaccuracyr      s     s4y$))+a.)DQJiiat,GA668DggfnnQ+55d;<G]ab]aXYNc!l#++B/557;;A>FS]abbbs   A	C))r
   )typingr   r   torchTensorintr        r   <module>r"      sP   $  c5<< c cU38_ cX\]b]i]iXj cr!   