4c13ae9d17d1709ed7a777ce1bb72212e8d2559d,tests/python/frontend/pytorch/test_object_detection.py,,test_detection_models,#,88
Before Change
// with pytorch output. Some boxes might have a quite tiny difference in score
// 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
After Change
with tvm.transform.PassContext(opt_level=3):
vm_exec = relay.vm.compile(mod, target=target, params=params)
ctx = tvm.context(target, 0)
vm = VirtualMachine(vm_exec, ctx)
vm.set_input("main", **{input_name: data_np})
tvm_res = vm.run()
// Bounding boxes
tvm.testing.assert_allclose(
pt_res[0].cpu().numpy(), tvm_res[0].asnumpy(), rtol=1e-5, atol=1e-5
)
// Scores
tvm.testing.assert_allclose(
pt_res[1].cpu().numpy(), tvm_res[1].asnumpy(), rtol=1e-5, atol=1e-5
)
// Class ids
np.testing.assert_equal(pt_res[2].cpu().numpy(), tvm_res[2].asnumpy())
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))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
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: 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: pytorch/examples
Commit Name: 645c7c386e62d2fb1d50f4621c1a52645a13869f
Time: 2018-04-24
Author: soumith@gmail.com
File Name: time_sequence_prediction/train.py
Class Name:
Method Name:
Project Name: onnx/onnx-coreml
Commit Name: b1b05d01fa879453ffced4839459a7daea180397
Time: 2018-11-06
Author: aseem.elec@gmail.com
File Name: tests/model_test.py
Class Name:
Method Name: _test_torch_model_single_io