Skip to content

Commit

Permalink
Fix flaky NMS test by making sure scores are unique (#9140)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored Sep 29, 2021
1 parent d7a28f9 commit 725ae75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/python/frontend/pytorch/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down

0 comments on commit 725ae75

Please sign in to comment.