2f0ba3e65cfa36b43bc87b315733fd3f3585e430,tests/ignite/metrics/test_accuracy.py,,test_multilabel_input_NHW,#,546

Before Change


        assert accuracy_score(np_y, np_y_pred) == pytest.approx(acc.compute())

    // check multiple random inputs as random exact occurencies are rare
    for _ in range(10):
        _test()


def test_incorrect_type():
    acc = Accuracy()

    // Start as binary data

After Change


    test_cases = [
        // Multilabel input data of shape (N, C, H, W, ...) and (N, C, H, W, ...)
        (torch.randint(0, 2, size=(4, 5, 12, 10)), torch.randint(0, 2, size=(4, 5, 12, 10)).long(), 1),
        (torch.randint(0, 2, size=(4, 10, 12, 8)).long(), torch.randint(0, 2, size=(4, 10, 12, 8)).long(), 1),
        (torch.randint(0, 2, size=(100, 5, 12, 10)), torch.randint(0, 2, size=(100, 5, 12, 10)).long(), 16),
    ]
    for y_pred, y, batch_size in test_cases:
        // check multiple random inputs as random exact occurencies are rare
        for _ in range(10):
            _test(y_pred, y, batch_size)


def test_incorrect_type():
    acc = Accuracy()

    // Start as binary data
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/ignite
Commit Name: 2f0ba3e65cfa36b43bc87b315733fd3f3585e430
Time: 2021-03-08
Author: momo.ah.yakoub@gmail.com
File Name: tests/ignite/metrics/test_accuracy.py
Class Name:
Method Name: test_multilabel_input_NHW


Project Name: OpenNMT/OpenNMT-py
Commit Name: a5763a81a2180e1d99f678d31f0fb7b9c26f4dff
Time: 2017-11-17
Author: pltrdy@gmail.com
File Name: onmt/modules/CopyGenerator.py
Class Name: CopyGeneratorLossCompute
Method Name: compute_loss


Project Name: OpenNMT/OpenNMT-py
Commit Name: 017517d06144919555f9d991f13639ee4cc4babb
Time: 2017-11-17
Author: pltrdy@gmail.com
File Name: onmt/modules/CopyGenerator.py
Class Name: CopyGeneratorLossCompute
Method Name: compute_loss