§
    ’©ºjg
  ã                   ór   — d dl mZ d dlmZmZ d dlmZ d dlmZ 	 ddededee	         d	ee
         d
ef
d„ZdS )é    )ÚOptional)ÚTensorÚtensor)Úbinary_auroc)Ú"_check_retrieval_functional_inputsNÚpredsÚtargetÚtop_kÚmax_fprÚreturnc                 ó¸  — t          | |¦  «        \  } }|p| j        d         }t          |t          ¦  «        r|dk    st	          d¦  «        ‚|                      t          || j        d         ¦  «        dd¬¦  «        d         }||         }d|vsd|vrt          d| j        | j	        ¬¦  «        S | |         } t          | |                     ¦   «         |¬	¦  «        S )
až  Compute area under the receiver operating characteristic curve (AUROC) for information retrieval.

    ``preds`` and ``target`` should be of the same shape and live on the same device. If no ``target`` is ``True``,
    ``0`` is returned. ``target`` must be either `bool` or `integers` and ``preds`` must be ``float``,
    otherwise an error is raised.

    Args:
        preds: estimated probabilities of each document to be relevant.
        target: ground truth about each document being relevant or not.
        top_k: consider only the top k elements (default: ``None``, which considers them all)
        max_fpr: If not ``None``, calculates standardized partial AUC over the range ``[0, max_fpr]``.

    Return:
        a single-value tensor with the auroc value of the predictions ``preds`` w.r.t. the labels ``target``.

    Raises:
        ValueError:
            If ``top_k`` is not ``None`` or an integer larger than 0.

    Example:
        >>> from torchmetrics.functional.retrieval import retrieval_auroc
        >>> preds = tensor([0.2, 0.3, 0.5])
        >>> target = tensor([True, False, True])
        >>> retrieval_auroc(preds, target)
        tensor(0.5000)

    éÿÿÿÿr   z,`top_k` has to be a positive integer or NoneT)ÚsortedÚdimé   g        )ÚdeviceÚdtype)r   )r   ÚshapeÚ
isinstanceÚintÚ
ValueErrorÚtopkÚminr   r   r   r   )r   r	   r
   r   Ú	top_k_idxs        úw/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/torchmetrics/functional/retrieval/auroc.pyÚretrieval_aurocr      sØ   € õ< 7°u¸fÑEÔE�M€Eˆ6àÐ$�U”[ ”_€EÝ�u�cÑ"Ô"ð I u¨q¢y yÝÐGÑHÔHÐHà—
’
�3˜u e¤k°"¤oÑ6Ô6¸tÈ�
ÑLÔLÈQÔO€IØ�IÔ€FØ	�ˆˆ˜Q f˜_˜_Ý�c %¤,°e´kÐBÑBÔBÐBà�)Ô€EÝ˜˜vŸzšz™|œ|°WÐ=Ñ=Ô=Ð=ó    )NN)Útypingr   Útorchr   r   Ú,torchmetrics.functional.classification.aurocr   Útorchmetrics.utilities.checksr   r   Úfloatr   © r   r   ú<module>r$      s°   ðð Ð Ð Ð Ð Ð à  Ð  Ð  Ð  Ð  Ð  Ð  Ð  à EÐ EÐ EÐ EÐ EÐ EØ LÐ LÐ LÐ LÐ LÐ Lð \`ð*>ð *>Øð*>Ø!ð*>Ø*2°3¬-ð*>ØIQÐRWÌð*>àð*>ð *>ð *>ð *>ð *>ð *>r   