def get_multiclass_statistics(
    outputs: Tensor,
    targets: Tensor,
    argmax_dim: int = -1,
    num_classes: Optional[int] = None,
) -> Tuple[Tensor, Tensor, Tensor, Tensor, Tensor, int]:
    """
    Computes the number of true negative, false positive,
    false negative, true positive and support
    for a multiclass classification problem.

    Args:
        outputs: estimated targets as predicted by a model
            with shape [bs; ..., (num_classes or 1)]
        targets: ground truth (correct) target values
            with shape [bs; ..., 1]
        argmax_dim: int, that specifies dimension for argmax transformation
            in case of scores/probabilities in ``outputs``
        num_classes: int, that specifies number of classes if it known

    Returns:
        Tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: stats

    Example:

    .. code-block:: python

        import torch
        from catalyst import metrics
        y_pred = torch.tensor([1, 2, 3, 0])
        y_true = torch.tensor([1, 3, 4, 0])
        tn, fp, fn, tp, support = metrics.get_multiclass_statistics(y_pred, y_true)
        # (
        #     tensor([3., 3., 3., 2., 3.]),
        #     tensor([0., 0., 1., 1., 0.]),
        #     tensor([0., 0., 0., 1., 1.]),
        #     tensor([1., 1., 0., 0., 0.]),
        #     tensor([1., 1., 0., 1., 1.])
        # )
    """
    outputs, targets, num_classes = process_multiclass_components(
        outputs=outputs, targets=targets, argmax_dim=argmax_dim, num_classes=num_classes
    )

    tn = torch.zeros((num_classes,), device=outputs.device)
    fp = torch.zeros((num_classes,), device=outputs.device)
    fn = torch.zeros((num_classes,), device=outputs.device)
    tp = torch.zeros((num_classes,), device=outputs.device)
    support = torch.zeros((num_classes,), device=outputs.device)

    for class_index in range(num_classes):
        (
            tn[class_index],
            fp[class_index],
            fn[class_index],
            tp[class_index],
            support[class_index],
        ) = get_binary_statistics(outputs=outputs, targets=targets, label=class_index)

    return tn, fp, fn, tp, support, num_classes

    Computes the number of true negative, false positive,
    false negative, true positive and support
    for a multiclass classification problem.

    Args:
        outputs: estimated targets as predicted by a model
            with shape [bs; ..., (num_classes or 1)]
        targets: ground truth (correct) target values
            with shape [bs; ..., 1]
        argmax_dim: int, that specifies dimension for argmax transformation
            in case of scores/probabilities in ``outputs``
        num_classes: int, that specifies number of classes if it known

    Returns:
        Tuple[Tensor, Tensor, Tensor, Tensor, Tensor]: stats

    Example:

    .. code-block:: python

        import torch
        from catalyst import metrics
        y_pred = torch.tensor([1, 2, 3, 0])
        y_true = torch.tensor([1, 3, 4, 0])
        tn, fp, fn, tp, support = metrics.get_multiclass_statistics(y_pred, y_true)
        # (
        #     tensor([3., 3., 3., 2., 3.]),
        #     tensor([0., 0., 1., 1., 0.]),
        #     tensor([0., 0., 0., 1., 1.]),
        #     tensor([1., 1., 0., 0., 0.]),
        #     tensor([1., 1., 0., 1., 1.])
        # )
    
catalyst/metrics/functional/_misc.py