e839626c28d8dc6030ce71f3619e934b36fb6627,catalyst/metrics/functional.py,,get_multiclass_statistics,#,167

Before Change


    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),
        )

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

After Change


        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,
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: get_multiclass_statistics


Project Name: carpedm20/ENAS-pytorch
Commit Name: 92c6ee78097c4c19837005168f77111e78dcbf0b
Time: 2018-03-04
Author: dukebw@mcmaster.ca
File Name: trainer.py
Class Name: Trainer
Method Name: train_shared


Project Name: PIQuIL/QuCumber
Commit Name: bc8dbb9fa560f3ff5334517e07e1a492b0489e74
Time: 2020-09-07
Author: emerali@users.noreply.github.com
File Name: qucumber/observables/observable.py
Class Name: ObservableBase
Method Name: statistics_from_samples