e839626c28d8dc6030ce71f3619e934b36fb6627,catalyst/metrics/functional.py,,process_multiclass_components,#,33

Before Change


            "expected 1D or 2D with size 1 in the second dim"
        )

    if targets.max() != len(torch.unique(targets)) - 1:
        if raise_class_labels_mismatch:
            raise Exception(
                "`targets` maximum does not represent number of classes"
            )
        // mapping classes
        outputs, targets = map_labels_to_classes(outputs, targets)
    return outputs, targets


def process_multilabel_components(

After Change


            outputs.shape[argmax_dim], int(targets.max().detach().item() + 1)
        )
        outputs = torch.argmax(outputs, dim=argmax_dim)
    if num_classes is None:
        // as far as we expect the outputs/targets tensors to be int64
        // we could find number of classes as max available number
        num_classes = max(
            int(outputs.max().detach().item() + 1),
            int(targets.max().detach().item() + 1),
        )

    if outputs.dim() == 1:
        outputs = outputs.view(-1, 1)
    else:
        assert outputs.size(1) == 1 and outputs.dim() == 2, (
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: Scitator/catalyst
Commit Name: e839626c28d8dc6030ce71f3619e934b36fb6627
Time: 2020-10-23
Author: Balaganskij.NN@phystech.edu
File Name: catalyst/metrics/functional.py
Class Name:
Method Name: process_multiclass_components


Project Name: chainer/chainercv
Commit Name: 90b78b1379b3423aa3b4b5d0de7313f88bda23ab
Time: 2019-02-17
Author: yuyuniitani@gmail.com
File Name: chainercv/utils/mask/mask_to_bbox.py
Class Name:
Method Name: mask_to_bbox


Project Name: snorkel-team/snorkel
Commit Name: 0514d4b6de97d652e6cd99c7b557018890a6ec99
Time: 2017-06-26
Author: ajratner@gmail.com
File Name: snorkel/learning/disc_learning.py
Class Name: TFNoiseAwareModel
Method Name: train