Skip to content

Commit

Permalink
Make sure there is no tie in scores in NMS test (apache#8335)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored and ylc committed Jan 13, 2022
1 parent f1c8026 commit 225dae6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/python/frontend/tensorflow/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -3442,8 +3442,14 @@ def _test_forward_combined_nms(
clip_boxes=False,
dtype="float32",
):
def get_random_scores(size, dtype):
size1d = np.prod(size)
scores = np.linspace(0, 1, num=size1d)
np.random.shuffle(scores)
return scores.reshape(size).astype(dtype)

boxes = np.random.uniform(-1, 2, size=bx_shape).astype(dtype)
scores = np.random.uniform(size=score_shape).astype(dtype)
scores = get_random_scores(score_shape, dtype)
max_output_size = np.int32(out_size)
tf.reset_default_graph()
in_data_1 = tf.placeholder(dtype, boxes.shape, name="in_data_1")
Expand Down

0 comments on commit 225dae6

Please sign in to comment.