From 725ae75af4997ff3a5107cc82d64609773de23a0 Mon Sep 17 00:00:00 2001 From: masahi Date: Thu, 30 Sep 2021 02:30:13 +0900 Subject: [PATCH] Fix flaky NMS test by making sure scores are unique (#9140) --- tests/python/frontend/pytorch/test_forward.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/python/frontend/pytorch/test_forward.py b/tests/python/frontend/pytorch/test_forward.py index c27469edf1d7..9238acd5f049 100644 --- a/tests/python/frontend/pytorch/test_forward.py +++ b/tests/python/frontend/pytorch/test_forward.py @@ -1963,8 +1963,9 @@ def _gen_rand_inputs(num_boxes): boxes = torch.rand(num_boxes, box_len, dtype=torch.float) * 0.5 boxes[:, 2] += boxes[:, 0] boxes[:, 3] += boxes[:, 1] - scores = torch.from_numpy(np.random.uniform(-1, 1, size=(num_boxes,)).astype(np.float32)) - return boxes, scores + scores = np.linspace(0, 1, num=num_boxes).astype("float32") + np.random.shuffle(scores) + return boxes, torch.from_numpy(scores) targets = ["llvm", "cuda"]