§
    ’©ºj¢\  ã                   óø  — d dl mZmZmZ d dlZd dlmZmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZmZmZmZmZmZ d dlmZmZmZ d dlmZmZ d dlmZ d d	lm Z  d d
l!m"Z" 	 	 	 d.deeee         f         deeee         f         deed                  dee         de#defd„Z$	 	 	 d/dee#         deee%e&e#         ef                  dee%         ddfd„Z'	 	 d0deee(eef         f         dee         dee#         de%def
d„Z)	 	 	 	 d1dededee#         deee%e&e#         ef                  dee%         d e*defd!„Z+	 	 	 d2d"e%deed                  deee%e&e#         ef                  dee%         ddf
d#„Z,	 	 d3deee(eef         f         d"e%deed                  dee         def
d$„Z-	 	 	 	 d4deded"e%deed                  deee%e&e#         ef                  dee%         d e*defd%„Z.	 	 d5d&e%deed'                  deee%e&e#         ef                  dee%         ddf
d(„Z/	 d6deee(eef         f         d&e%deed'                  dee         dee%         defd)„Z0	 	 	 	 d4deded&e%deed'                  deee%e&e#         ef                  dee%         d e*defd*„Z1	 	 	 	 	 	 	 d7deded+ed,         deee%e&e#         ef                  d"ee%         d&ee%         deed                  dee#         dee%         d e*dee         fd-„Z2dS )8é    )ÚListÚOptionalÚUnionN)ÚTensorÚtensor)ÚLiteral)Ú-_binary_precision_recall_curve_arg_validationÚ%_binary_precision_recall_curve_formatÚ0_binary_precision_recall_curve_tensor_validationÚ%_binary_precision_recall_curve_updateÚ1_multiclass_precision_recall_curve_arg_validationÚ)_multiclass_precision_recall_curve_formatÚ4_multiclass_precision_recall_curve_tensor_validationÚ)_multiclass_precision_recall_curve_updateÚ1_multilabel_precision_recall_curve_arg_validationÚ)_multilabel_precision_recall_curve_formatÚ4_multilabel_precision_recall_curve_tensor_validationÚ)_multilabel_precision_recall_curve_update)Ú_binary_roc_computeÚ_multiclass_roc_computeÚ_multilabel_roc_compute)Ú_auc_compute_without_checkÚ_safe_divide)Ú	_bincount)ÚClassificationTask)Úrank_zero_warnÚmacroç      ð?ÚfprÚtprÚaverage)r   ÚweightedÚnoneÚweightsÚ	directionÚreturnc                 óœ  ‡— t          | t          ¦  «        r)t          |t          ¦  «        rt          | |‰d¬¦  «        }n.t          j        ˆfd„t          | |¦  «        D ¦   «         ¦  «        }|�|dk    r|S t          j        |¦  «                             ¦   «         rt          d|› d�t          ¦  «         t          j        |¦  «         }|dk    r||          
                    ¦   «         S |d	k    rM|�Kt          ||         ||                              ¦   «         ¦  «        }||         |z                       ¦   «         S t          d
¦  «        ‚)z8Reduce multiple average precision score into one number.é   )r%   Úaxisc                 ó:   •— g | ]\  }}t          ||‰¬ ¦  «        ‘ŒS ))r%   )r   )Ú.0ÚxÚyr%   s      €ú|/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/torchmetrics/functional/classification/auroc.pyú
<listcomp>z!_reduce_auroc.<locals>.<listcomp>8   s0   ø€ ÐkÐkÐkÑUYÐUVÐXYÕ5°a¸ÀiÐPÑPÔPÐkÐkÐkó    Nr#   zUAverage precision score for one or more classes was `nan`. Ignoring these classes in z-averager   r"   zBReceived an incompatible combinations of inputs to make reduction.)Ú
isinstancer   r   ÚtorchÚstackÚzipÚisnanÚanyr   ÚUserWarningÚmeanr   ÚsumÚ
ValueError)r   r    r!   r$   r%   ÚresÚidxs       `  r.   Ú_reduce_aurocr=   -   sW  ø€ õ �#•vÑÔð m¥:¨cµ6Ñ#:Ô#:ð mÝ(¨¨c¸YÈQÐOÑOÔOˆˆåŒkÐkÐkÐkÐkÕ]`ÐadÐfiÑ]jÔ]jÐkÑkÔkÑlÔlˆØ€˜' VÒ+Ð+Øˆ
Ý„{�3ÑÔ×ÒÑÔð 
ÝØuÐdkÐuÐuÐuÝñ	
ô 	
ð 	
õ Œ;�sÑÔÐ
€CØ�'ÒÐØ�3Œx�}Š}‰ŒÐØ�*ÒÐ Ð!4Ý˜w sœ|¨W°S¬\×-=Ò-=Ñ-?Ô-?Ñ@Ô@ˆØ�C”˜7Ñ"×'Ò'Ñ)Ô)Ð)Ý
ÐYÑ
ZÔ
ZÐZr0   Úmax_fprÚ
thresholdsÚignore_indexc                 ó¢   — t          ||¦  «         | �8t          | t          ¦  «        s%d| cxk     rdk    rn d S t          d| › �¦  «        ‚d S d S d S )Nr   r(   z@Arguments `max_fpr` should be a float in range (0, 1], but got: )r	   r1   Úfloatr:   )r>   r?   r@   s      r.   Ú_binary_auroc_arg_validationrC   I   sz   € õ
 2°*¸lÑKÔKÐKØÐ¥:¨gµuÑ#=Ô#=ÐÀ!ÀgÐBRÐBRÒBRÐBRÐQRÒBRÐBRÐBRÐBRÐBRÐBRÝÐeÐ\cÐeÐeÑfÔfÐfð ÐÐÐÐBRÐBRr0   r(   ÚstateÚ	pos_labelc                 ó
  — t          | ||¦  «        \  }}}|�6|dk    s0|                     ¦   «         dk    s|                     ¦   «         dk    rt          ||d¦  «        S t          |t          ¦  «        r|j        n|d         j        }t          ||¬¦  «        }t          j        ||dd¬¦  «        }	|||	dz
           z
  ||	         ||	dz
           z
  z  }
t          j	        ||	dz
           ||	         |
¦  «        }t          j
        |d |	…         |                     d¦  «        g¦  «        }t          j
        |d |	…         |                     d¦  «        g¦  «        }t          ||d¦  «        }d|dz  z  }dd||z
  ||z
  z  z   z  S )	Nr(   r   r   )ÚdeviceT)Ú	out_int32Úrightg      à?é   )r   r9   r   r1   r   rG   r   r2   Ú	bucketizeÚlerpÚcatÚview)rD   r?   r>   rE   r   r    Ú_Ú_deviceÚmax_areaÚstopÚweightÚ
interp_tprÚpartial_aucÚmin_areas                 r.   Ú_binary_auroc_computerW   S   s}  € õ & e¨Z¸ÑCÔC�K€CˆˆaØ€˜' Qš,˜,¨#¯'ª'©)¬)°qª.¨.¸C¿GºG¹I¼IÈºN¸NÝ)¨#¨s°CÑ8Ô8Ð8å& s­FÑ3Ô3ÐFˆcŒjˆj¸¸Q¼¼€GÝ˜g¨gÐ6Ñ6Ô6€HåŒ?˜8 S°DÀÐEÑEÔE€DØ˜˜T A™XœÑ&¨3¨t¬9°s¸4À!¹8´}Ñ+DÑE€FÝœ C¨¨q©¤M°3°t´9¸fÑEÔE€JÝ
Œ)�S˜˜$˜”Z §¢°Ñ!3Ô!3Ð4Ñ
5Ô
5€CÝ
Œ)�S˜˜$˜”Z §¢¨qÑ!1Ô!1Ð2Ñ
3Ô
3€Cõ -¨S°#°sÑ;Ô;€Kð ˜X q™[Ñ(€HØ�!�{ XÑ-°(¸XÑ2EÑFÑFÑGÐGr0   TÚpredsÚtargetÚvalidate_argsc                 óº   — |r"t          |||¦  «         t          | ||¦  «         t          | |||¦  «        \  } }}t          | ||¦  «        }t	          |||¦  «        S )aß  Compute Area Under the Receiver Operating Characteristic Curve (`ROC AUC`_) for binary tasks.

    The AUROC score summarizes the ROC curve into an single number that describes the performance of a model for
    multiple thresholds at the same time. Notably, an AUROC score of 1 is a perfect score and an AUROC score of 0.5
    corresponds to random guessing.

    Accepts the following input tensors:

    - ``preds`` (float tensor): ``(N, ...)``. Preds should be a tensor containing probabilities or logits for each
      observation. If preds has values outside [0,1] range we consider the input to be logits and will auto apply
      sigmoid per element.
    - ``target`` (int tensor): ``(N, ...)``. Target should be a tensor containing ground truth labels, and therefore
      only contain {0,1} values (except if `ignore_index` is specified). The value 1 always encodes the positive class.

    Additional dimension ``...`` will be flattened into the batch dimension.

    The implementation both supports calculating the metric in a non-binned but accurate version and a binned version
    that is less accurate but more memory efficient. Setting the `thresholds` argument to `None` will activate the
    non-binned  version that uses memory of size :math:`\mathcal{O}(n_{samples})` whereas setting the `thresholds`
    argument to either an integer, list or a 1d tensor will use a binned version that uses memory of
    size :math:`\mathcal{O}(n_{thresholds})` (constant memory).

    Args:
        preds: Tensor with predictions
        target: Tensor with true labels
        max_fpr: If not ``None``, calculates standardized partial AUC over the range ``[0, max_fpr]``.
        thresholds:
            Can be one of:

            - If set to `None`, will use a non-binned approach where thresholds are dynamically calculated from
              all the data. Most accurate but also most memory consuming approach.
            - If set to an `int` (larger than 1), will use that number of thresholds linearly spaced from
              0 to 1 as bins for the calculation.
            - If set to an `list` of floats, will use the indicated thresholds in the list as bins for the calculation
            - If set to an 1d `tensor` of floats, will use the indicated thresholds in the tensor as
              bins for the calculation.

        ignore_index:
            Specifies a target value that is ignored and does not contribute to the metric calculation
        validate_args: bool indicating if input arguments and tensors should be validated for correctness.
            Set to ``False`` for faster computations.

    Returns:
        A single scalar with the auroc score

    Example:
        >>> from torchmetrics.functional.classification import binary_auroc
        >>> preds = torch.tensor([0, 0.5, 0.7, 0.8])
        >>> target = torch.tensor([0, 1, 1, 0])
        >>> binary_auroc(preds, target, thresholds=None)
        tensor(0.5000)
        >>> binary_auroc(preds, target, thresholds=5)
        tensor(0.5000)

    )rC   r   r
   r   rW   )rX   rY   r>   r?   r@   rZ   rD   s          r.   Úbinary_aurocr\   n   sq   € ð~ ð VÝ$ W¨j¸,ÑGÔGÐGÝ8¸ÀÈÑUÔUÐUÝ EÀeÈVÐU_ÐamÑ nÔ nÑ€Eˆ6�:Ý1°%¸ÀÑLÔL€EÝ  ¨
°GÑ<Ô<Ð<r0   Únum_classesc                 ó^   — t          | ||¦  «         d}||vrt          d|› d|› �¦  «        ‚d S )N)r   r"   r#   Nú)Expected argument `average` to be one of ú	 but got )r   r:   )r]   r!   r?   r@   Úallowed_averages        r.   Ú _multiclass_auroc_arg_validationrb   µ   sN   € õ 6°kÀ:È|Ñ\Ô\Ð\Ø9€OØ�oÐ%Ð%ÝÐhÀ_ÐhÐhÐ_fÐhÐhÑiÔiÐið &Ð%r0   c           
      óô   — t          | ||¦  «        \  }}}t          ||||€)t          | d         |¬¦  «                             ¦   «         n'| d         d d …dd d …f                              d¦  «        ¬¦  «        S )Nr(   )Ú	minlengthr   éÿÿÿÿ©r$   )r   r=   r   rB   r9   )rD   r]   r!   r?   r   r    rO   s          r.   Ú_multiclass_auroc_computerg   Á   s–   € õ *¨%°¸jÑIÔI�K€CˆˆaÝØØØØFPÐFX•	˜% œ(¨kÐ:Ñ:Ô:×@Ò@ÑBÔBÐBÐ^cÐdeÔ^fÐghÐghÐghÐjkÐmnÐmnÐmnÐgnÔ^o×^sÒ^sÐtvÑ^wÔ^wð	ñ ô ð r0   c                 óÄ   — |r$t          ||||¦  «         t          | |||¦  «         t          | ||||¦  «        \  } }}t          | |||¦  «        }t	          ||||¦  «        S )a  Compute Area Under the Receiver Operating Characteristic Curve (`ROC AUC`_) for multiclass tasks.

    The AUROC score summarizes the ROC curve into an single number that describes the performance of a model for
    multiple thresholds at the same time. Notably, an AUROC score of 1 is a perfect score and an AUROC score of 0.5
    corresponds to random guessing.

    Accepts the following input tensors:

    - ``preds`` (float tensor): ``(N, C, ...)``. Preds should be a tensor containing probabilities or logits for each
      observation. If preds has values outside [0,1] range we consider the input to be logits and will auto apply
      softmax per sample.
    - ``target`` (int tensor): ``(N, ...)``. Target should be a tensor containing ground truth labels, and therefore
      only contain values in the [0, n_classes-1] range (except if `ignore_index` is specified).

    Additional dimension ``...`` will be flattened into the batch dimension.

    The implementation both supports calculating the metric in a non-binned but accurate version and a binned version
    that is less accurate but more memory efficient. Setting the `thresholds` argument to `None` will activate the
    non-binned  version that uses memory of size :math:`\mathcal{O}(n_{samples})` whereas setting the `thresholds`
    argument to either an integer, list or a 1d tensor will use a binned version that uses memory of
    size :math:`\mathcal{O}(n_{thresholds} \times n_{classes})` (constant memory).

    Args:
        preds: Tensor with predictions
        target: Tensor with true labels
        num_classes: Integer specifying the number of classes
        average:
            Defines the reduction that is applied over classes. Should be one of the following:

            - ``macro``: Calculate score for each class and average them
            - ``weighted``: calculates score for each class and computes weighted average using their support
            - ``"none"`` or ``None``: calculates score for each class and applies no reduction
        thresholds:
            Can be one of:

            - If set to `None`, will use a non-binned approach where thresholds are dynamically calculated from
              all the data. Most accurate but also most memory consuming approach.
            - If set to an `int` (larger than 1), will use that number of thresholds linearly spaced from
              0 to 1 as bins for the calculation.
            - If set to an `list` of floats, will use the indicated thresholds in the list as bins for the calculation
            - If set to an 1d `tensor` of floats, will use the indicated thresholds in the tensor as
              bins for the calculation.

        ignore_index:
            Specifies a target value that is ignored and does not contribute to the metric calculation
        validate_args: bool indicating if input arguments and tensors should be validated for correctness.
            Set to ``False`` for faster computations.

    Returns:
        If `average=None|"none"` then a 1d tensor of shape (n_classes, ) will be returned with auroc score per class.
        If `average="macro"|"weighted"` then a single scalar is returned.

    Example:
        >>> from torchmetrics.functional.classification import multiclass_auroc
        >>> preds = torch.tensor([[0.75, 0.05, 0.05, 0.05, 0.05],
        ...                       [0.05, 0.75, 0.05, 0.05, 0.05],
        ...                       [0.05, 0.05, 0.75, 0.05, 0.05],
        ...                       [0.05, 0.05, 0.05, 0.75, 0.05]])
        >>> target = torch.tensor([0, 1, 3, 2])
        >>> multiclass_auroc(preds, target, num_classes=5, average="macro", thresholds=None)
        tensor(0.5333)
        >>> multiclass_auroc(preds, target, num_classes=5, average=None, thresholds=None)
        tensor([1.0000, 1.0000, 0.3333, 0.3333, 0.0000])
        >>> multiclass_auroc(preds, target, num_classes=5, average="macro", thresholds=5)
        tensor(0.5333)
        >>> multiclass_auroc(preds, target, num_classes=5, average=None, thresholds=5)
        tensor([1.0000, 1.0000, 0.3333, 0.3333, 0.0000])

    )rb   r   r   r   rg   )rX   rY   r]   r!   r?   r@   rZ   rD   s           r.   Úmulticlass_aurocri   Ð   s‚   € ð\ ð gÝ(¨°g¸zÈ<ÑXÔXÐXÝ<¸UÀFÈKÐYeÑfÔfÐfÝ IØˆv�{ J°ñ!ô !Ñ€Eˆ6�:õ 6°e¸VÀ[ÐR\Ñ]Ô]€EÝ$ U¨K¸À*ÑMÔMÐMr0   Ú
num_labels)Úmicror   r"   r#   c                 ó^   — t          | ||¦  «         d}||vrt          d|› d|› �¦  «        ‚d S )N)rk   r   r"   r#   Nr_   r`   )r   r:   )rj   r!   r?   r@   ra   s        r.   Ú _multilabel_auroc_arg_validationrm   (  sN   € õ 6°jÀ*ÈlÑ[Ô[Ð[ØB€OØ�oÐ%Ð%ÝÐhÀ_ÐhÐhÐ_fÐhÐhÑiÔiÐið &Ð%r0   c           
      óP  — |dk    ržt          | t          ¦  «        r'|�%t          |                      d¦  «        |d ¬¦  «        S | d                              ¦   «         }| d                              ¦   «         }|�||k    }||          }||          }t          ||f|d ¬¦  «        S t          | |||¦  «        \  }}	}
t          ||	||€2| d         dk                         d¬¦  «                             ¦   «         n'| d         d d …dd d …f                              d¦  «        ¬¦  «        S )Nrk   r(   )r>   r   )Údimre   rf   )r1   r   rW   r9   Úflattenr   r=   rB   )rD   rj   r!   r?   r@   rX   rY   r<   r   r    rO   s              r.   Ú_multilabel_auroc_computerq   4  sI  € ð �'ÒÐÝ�e�VÑ$Ô$ð 	Q¨Ð)?Ý(¨¯ª°1©¬°zÈ4ÐPÑPÔPÐPà�a”× Ò Ñ"Ô"ˆØ�q”×!Ò!Ñ#Ô#ˆØÐ#Ø˜LÒ(ˆCØ˜3˜$”KˆEØ˜S˜D”\ˆFÝ$ e¨V _°jÈ$ÐOÑOÔOÐOå)¨%°¸ZÈÑVÔV�K€CˆˆaÝØØØØ6@Ð6H��q”˜Q’×#Ò#¨Ð#Ñ*Ô*×0Ò0Ñ2Ô2Ð2ÈeÐTUÌhÐWXÐWXÐWXÐZ[Ð]^Ð]^Ð]^ÐW^ÔN_×NcÒNcÐdfÑNgÔNgð	ñ ô ð r0   c                 óÆ   — |r$t          ||||¦  «         t          | |||¦  «         t          | ||||¦  «        \  } }}t          | |||¦  «        }t	          |||||¦  «        S )al  Compute Area Under the Receiver Operating Characteristic Curve (`ROC AUC`_) for multilabel tasks.

    The AUROC score summarizes the ROC curve into an single number that describes the performance of a model for
    multiple thresholds at the same time. Notably, an AUROC score of 1 is a perfect score and an AUROC score of 0.5
    corresponds to random guessing.

    Accepts the following input tensors:

    - ``preds`` (float tensor): ``(N, C, ...)``. Preds should be a tensor containing probabilities or logits for each
      observation. If preds has values outside [0,1] range we consider the input to be logits and will auto apply
      sigmoid per element.
    - ``target`` (int tensor): ``(N, C, ...)``. Target should be a tensor containing ground truth labels, and therefore
      only contain {0,1} values (except if `ignore_index` is specified).

    Additional dimension ``...`` will be flattened into the batch dimension.

    The implementation both supports calculating the metric in a non-binned but accurate version and a binned version
    that is less accurate but more memory efficient. Setting the `thresholds` argument to `None` will activate the
    non-binned  version that uses memory of size :math:`\mathcal{O}(n_{samples})` whereas setting the `thresholds`
    argument to either an integer, list or a 1d tensor will use a binned version that uses memory of
    size :math:`\mathcal{O}(n_{thresholds} \times n_{labels})` (constant memory).

    Args:
        preds: Tensor with predictions
        target: Tensor with true labels
        num_labels: Integer specifying the number of labels
        average:
            Defines the reduction that is applied over labels. Should be one of the following:

            - ``micro``: Sum score over all labels
            - ``macro``: Calculate score for each label and average them
            - ``weighted``: calculates score for each label and computes weighted average using their support
            - ``"none"`` or ``None``: calculates score for each label and applies no reduction
        thresholds:
            Can be one of:

            - If set to `None`, will use a non-binned approach where thresholds are dynamically calculated from
              all the data. Most accurate but also most memory consuming approach.
            - If set to an `int` (larger than 1), will use that number of thresholds linearly spaced from
              0 to 1 as bins for the calculation.
            - If set to an `list` of floats, will use the indicated thresholds in the list as bins for the calculation
            - If set to an 1d `tensor` of floats, will use the indicated thresholds in the tensor as
              bins for the calculation.

        ignore_index:
            Specifies a target value that is ignored and does not contribute to the metric calculation
        validate_args: bool indicating if input arguments and tensors should be validated for correctness.
            Set to ``False`` for faster computations.

    Returns:
        If `average=None|"none"` then a 1d tensor of shape (n_classes, ) will be returned with auroc score per class.
        If `average="micro|macro"|"weighted"` then a single scalar is returned.

    Example:
        >>> from torchmetrics.functional.classification import multilabel_auroc
        >>> preds = torch.tensor([[0.75, 0.05, 0.35],
        ...                       [0.45, 0.75, 0.05],
        ...                       [0.05, 0.55, 0.75],
        ...                       [0.05, 0.65, 0.05]])
        >>> target = torch.tensor([[1, 0, 1],
        ...                        [0, 0, 0],
        ...                        [0, 1, 1],
        ...                        [1, 1, 1]])
        >>> multilabel_auroc(preds, target, num_labels=3, average="macro", thresholds=None)
        tensor(0.6528)
        >>> multilabel_auroc(preds, target, num_labels=3, average=None, thresholds=None)
        tensor([0.6250, 0.5000, 0.8333])
        >>> multilabel_auroc(preds, target, num_labels=3, average="macro", thresholds=5)
        tensor(0.6528)
        >>> multilabel_auroc(preds, target, num_labels=3, average=None, thresholds=5)
        tensor([0.6250, 0.5000, 0.8333])

    )rm   r   r   r   rq   )rX   rY   rj   r!   r?   r@   rZ   rD   s           r.   Úmultilabel_aurocrs   P  s„   € ðd ð fÝ(¨°W¸jÈ,ÑWÔWÐWÝ<¸UÀFÈJÐXdÑeÔeÐeÝ IØˆv�z :¨|ñ!ô !Ñ€Eˆ6�:õ 6°e¸VÀZÐQ[Ñ\Ô\€EÝ$ U¨J¸ÀÈ\ÑZÔZÐZr0   Útask)ÚbinaryÚ
multiclassÚ
multilabelc
           	      óÞ  — t          j        |¦  «        }|t           j        k    rt          | |||||	¦  «        S |t           j        k    rJt          |t          ¦  «        s t          dt          |¦  «        › d�¦  «        ‚t          | ||||||	¦  «        S |t           j
        k    rJt          |t          ¦  «        s t          dt          |¦  «        › d�¦  «        ‚t          | ||||||	¦  «        S dS )aÂ  Compute Area Under the Receiver Operating Characteristic Curve (`ROC AUC`_).

    The AUROC score summarizes the ROC curve into an single number that describes the performance of a model for
    multiple thresholds at the same time. Notably, an AUROC score of 1 is a perfect score and an AUROC score of 0.5
    corresponds to random guessing.

    This function is a simple wrapper to get the task specific versions of this metric, which is done by setting the
    ``task`` argument to either ``'binary'``, ``'multiclass'`` or ``'multilabel'``. See the documentation of
    :func:`~torchmetrics.functional.classification.binary_auroc`,
    :func:`~torchmetrics.functional.classification.multiclass_auroc` and
    :func:`~torchmetrics.functional.classification.multilabel_auroc` for the specific details of
    each argument influence and examples.

    Legacy Example:
        >>> preds = torch.tensor([0.13, 0.26, 0.08, 0.19, 0.34])
        >>> target = torch.tensor([0, 0, 1, 1, 1])
        >>> auroc(preds, target, task='binary')
        tensor(0.5000)

        >>> preds = torch.tensor([[0.90, 0.05, 0.05],
        ...                       [0.05, 0.90, 0.05],
        ...                       [0.05, 0.05, 0.90],
        ...                       [0.85, 0.05, 0.10],
        ...                       [0.10, 0.10, 0.80]])
        >>> target = torch.tensor([0, 1, 1, 2, 2])
        >>> auroc(preds, target, task='multiclass', num_classes=3)
        tensor(0.7778)

    z+`num_classes` is expected to be `int` but `z was passed.`z*`num_labels` is expected to be `int` but `N)r   Úfrom_strÚBINARYr\   Ú
MULTICLASSr1   Úintr:   Útyperi   Ú
MULTILABELrs   )
rX   rY   rt   r?   r]   rj   r!   r>   r@   rZ   s
             r.   Úaurocr   ¬  s  € õR Ô& tÑ,Ô,€DØÕ!Ô(Ò(Ð(Ý˜E 6¨7°JÀÈmÑ\Ô\Ð\ØÕ!Ô,Ò,Ð,Ý˜+¥sÑ+Ô+ð 	mÝÐkÍ4ÐP[ÑK\ÔK\ÐkÐkÐkÑlÔlÐlÝ  v¨{¸GÀZÐQ]Ð_lÑmÔmÐmØÕ!Ô,Ò,Ð,Ý˜*¥cÑ*Ô*ð 	kÝÐiÍ$ÈzÑJZÔJZÐiÐiÐiÑjÔjÐjÝ  v¨z¸7ÀJÐP\Ð^kÑlÔlÐlØˆ4r0   )r   Nr   )NNN)Nr(   )NNNT)r   NN)r   N)r   NNT)NN)N)NNNr   NNT)3Útypingr   r   r   r2   r   r   Útyping_extensionsr   Ú=torchmetrics.functional.classification.precision_recall_curver	   r
   r   r   r   r   r   r   r   r   r   r   Ú*torchmetrics.functional.classification.rocr   r   r   Útorchmetrics.utilities.computer   r   Útorchmetrics.utilities.datar   Útorchmetrics.utilities.enumsr   Útorchmetrics.utilities.printsr   rB   r=   r|   ÚlistrC   ÚtuplerW   Úboolr\   rb   rg   ri   rm   rq   rs   r   © r0   r.   ú<module>rŒ      s¨  ðð )Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (à €€€Ø  Ð  Ð  Ð  Ð  Ð  Ð  Ð  Ø %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð
 TÐ SÐ SÐ SÐ SÐ SÐ SÐ SØ 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8ð ?FØ $Øð[ð [Ø	ˆv�t˜F”|Ð#Ô	$ð[à	ˆv�t˜F”|Ð#Ô	$ð[ð �gÐ9Ô:Ô;ð[ð �fÔð	[ð
 ð[ð ð[ð [ð [ð [ð:  $Ø<@Ø"&ðgð gØ�eŒ_ðgà˜˜s D¨¤K°Ð7Ô8Ô9ðgð ˜3”-ðgð 
ð	gð gð gð gð  $Øð	Hð HØ�˜˜v v˜~Ô.Ð.Ô/ðHà˜Ô ðHð �eŒ_ðHð ð	Hð
 ðHð Hð Hð Hð<  $Ø<@Ø"&ØðD=ð D=ØðD=àðD=ð �eŒ_ðD=ð ˜˜s D¨¤K°Ð7Ô8Ô9ð	D=ð
 ˜3”-ðD=ð ðD=ð ðD=ð D=ð D=ð D=ðR ?FØ<@Ø"&ð		jð 	jØð	jà�gÐ9Ô:Ô;ð	jð ˜˜s D¨¤K°Ð7Ô8Ô9ð	jð ˜3”-ð		jð
 
ð	jð 	jð 	jð 	jð ?FØ#'ð	ð Ø�˜˜v v˜~Ô.Ð.Ô/ðàðð �gÐ9Ô:Ô;ðð ˜Ô ð	ð
 ðð ð ð ð& ?FØ<@Ø"&ØðUNð UNØðUNàðUNð ðUNð �gÐ9Ô:Ô;ð	UNð
 ˜˜s D¨¤K°Ð7Ô8Ô9ðUNð ˜3”-ðUNð ðUNð ðUNð UNð UNð UNðv =AØ"&ð		jð 	jØð	jà�gÐBÔCÔDð	jð ˜˜s D¨¤K°Ð7Ô8Ô9ð	jð ˜3”-ð		jð
 
ð	jð 	jð 	jð 	jð" #'ðð Ø�˜˜v v˜~Ô.Ð.Ô/ðàðð �gÐBÔCÔDðð ˜Ô ð	ð
 ˜3”-ðð ðð ð ð ð@ HOØ<@Ø"&ØðY[ð Y[ØðY[àðY[ð ðY[ð �gÐBÔCÔDð	Y[ð
 ˜˜s D¨¤K°Ð7Ô8Ô9ðY[ð ˜3”-ðY[ð ðY[ð ðY[ð Y[ð Y[ð Y[ð@ =AØ!%Ø $Ø>EØ#Ø"&Øð4ð 4Øð4àð4ð Ð6Ô
7ð4ð ˜˜s D¨¤K°Ð7Ô8Ô9ð	4ð
 ˜#”ð4ð ˜”ð4ð �gÐ9Ô:Ô;ð4ð �eŒ_ð4ð ˜3”-ð4ð ð4ð ˆfÔð4ð 4ð 4ð 4ð 4ð 4r0   