4c13ae9d17d1709ed7a777ce1bb72212e8d2559d,tests/python/frontend/pytorch/test_object_detection.py,,test_detection_models,#,88

Before Change


    // and the order can become different. We just measure how many valid boxes
    // there are for input image.
    pt_scores = pt_res[1].detach().numpy().tolist()
    tvm_scores = tvm_res[1].asnumpy().tolist()
    num_pt_valid_scores = num_tvm_valid_scores = 0

    for score in pt_scores:
        if score >= score_threshold:
            num_pt_valid_scores += 1
        else:
            break

    for score in tvm_scores:
        if score >= score_threshold:
            num_tvm_valid_scores += 1
        else:
            break

    assert num_pt_valid_scores == num_tvm_valid_scores, (
        "Output mismatch: Under score threshold {}, Pytorch has {} valid "
        "boxes while TVM has {}.".format(score_threshold, num_pt_valid_scores, num_tvm_valid_scores)
    )

After Change



        score_threshold = 0.9
        print("Num boxes:", pt_res[0].cpu().numpy().shape[0])
        print("Num valid boxes:", np.sum(pt_res[1].cpu().numpy() >= score_threshold))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: apache/incubator-tvm
Commit Name: 4c13ae9d17d1709ed7a777ce1bb72212e8d2559d
Time: 2020-12-25
Author: masahi129@gmail.com
File Name: tests/python/frontend/pytorch/test_object_detection.py
Class Name:
Method Name: test_detection_models


Project Name: mahyarnajibi/SNIPER
Commit Name: 72caa3677f5f9cc09ed98324c76454c38a7e8098
Time: 2018-06-04
Author: mahyarnajibi@gmail.com
File Name: lib/metric.py
Class Name: MaskLogLossMetric
Method Name: update


Project Name: dmlc/gluon-cv
Commit Name: ee602b6f68f0bdd19f449a86955697f8f0a2d54c
Time: 2019-09-21
Author: yizhu59@gmail.com
File Name: gluoncv/data/transforms/video.py
Class Name: VideoMultiScaleCrop
Method Name: forward