def auc(scores: torch.Tensor, targets: torch.Tensor) -> torch.Tensor:
    """Computes ROC-AUC.

    Args:
        scores: NxK tensor that for each of the N examples
            indicates the probability of the example belonging to each of
            the K classes, according to the model.
        targets:  binary NxK tensort that encodes which of the K
            classes are associated with the N-th input
            (eg: a row [0, 1, 0, 1] indicates that the example is
            associated with classes 2 and 4)

    Returns:
        torch.Tensor: Tensor with [num_classes] shape of per-class-aucs

    Examples:

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.auc(
            scores=torch.tensor([
                [0.9, 0.1],
                [0.1, 0.9],
            ]),
            targets=torch.tensor([
                [1, 0],
                [0, 1],
            ]),
        )
        # tensor([1., 1.])

    .. code-block:: python

        from catalyst import metrics
        metrics.auc(
            scores=torch.tensor([
                [0.9],
                [0.8],
                [0.7],
                [0.6],
                [0.5],
                [0.4],
                [0.3],
                [0.2],
                [0.1],
                [0.0],
            ]),
            targets=torch.tensor([
                [0],
                [1],
                [1],
                [1],
                [1],
                [1],
                [1],
                [0],
                [0],
                [0],
            ]),
        )
        # tensor([0.7500])

    .. warning::

        This metric is under API improvement.
    """
    if len(scores) == 0:
        return 0.5
    if len(scores.shape) < 2:
        scores.unsqueeze_(dim=1)
    if len(targets.shape) < 2:
        targets.unsqueeze_(dim=1)
    assert scores.shape == targets.shape

    per_class_auc = []
    for class_i in range(scores.shape[1]):
        per_class_auc.append(binary_auc(scores[:, class_i], targets[:, class_i])[0])
    output = torch.Tensor(per_class_auc)
    return output
Computes ROC-AUC.

    Args:
        scores: NxK tensor that for each of the N examples
            indicates the probability of the example belonging to each of
            the K classes, according to the model.
        targets:  binary NxK tensort that encodes which of the K
            classes are associated with the N-th input
            (eg: a row [0, 1, 0, 1] indicates that the example is
            associated with classes 2 and 4)

    Returns:
        torch.Tensor: Tensor with [num_classes] shape of per-class-aucs

    Examples:

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.auc(
            scores=torch.tensor([
                [0.9, 0.1],
                [0.1, 0.9],
            ]),
            targets=torch.tensor([
                [1, 0],
                [0, 1],
            ]),
        )
        # tensor([1., 1.])

    .. code-block:: python

        from catalyst import metrics
        metrics.auc(
            scores=torch.tensor([
                [0.9],
                [0.8],
                [0.7],
                [0.6],
                [0.5],
                [0.4],
                [0.3],
                [0.2],
                [0.1],
                [0.0],
            ]),
            targets=torch.tensor([
                [0],
                [1],
                [1],
                [1],
                [1],
                [1],
                [1],
                [0],
                [0],
                [0],
            ]),
        )
        # tensor([0.7500])

    .. warning::

        This metric is under API improvement.
    
catalyst/metrics/functional/_auc.py