From 225dae65838339c1872b80a7a8bfc707af51b2aa Mon Sep 17 00:00:00 2001 From: masahi Date: Sat, 26 Jun 2021 05:08:21 +0900 Subject: [PATCH] Make sure there is no tie in scores in NMS test (#8335) --- tests/python/frontend/tensorflow/test_forward.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/python/frontend/tensorflow/test_forward.py b/tests/python/frontend/tensorflow/test_forward.py index 2f4c0233d1a1..b49af1811cb5 100644 --- a/tests/python/frontend/tensorflow/test_forward.py +++ b/tests/python/frontend/tensorflow/test_forward.py @@ -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")