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"

After Change


        targets = torch.from_numpy(targets)

    // @TODO: move to process_multiclass_components ?
    if outputs.dim() == targets.dim() + 1:
        // looks like we have scores/probabilities in our outputs
        // let"s convert them to final model predictions
        num_classes = max(
            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(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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: has2k1/plotnine
Commit Name: 666b01f0a3c060be93b804b27814af58e1e50aac
Time: 2020-03-21
Author: has2k1@gmail.com
File Name: plotnine/aes.py
Class Name:
Method Name: reorder


Project Name: theislab/scanpy
Commit Name: 746bc9a03bef9c0a9686c43b44d1aac7d09f08da
Time: 2020-10-06
Author: awnimousa@gmail.com
File Name: scanpy/external/tl/_harmony_timeseries.py
Class Name:
Method Name: harmony_timeseries