From 372eb68010bb65417fd4c67240ddb2a0db146c03 Mon Sep 17 00:00:00 2001 From: Masahiro Masuda Date: Fri, 25 Jun 2021 07:24:47 +0900 Subject: [PATCH] Make sure there is no tie in scores in NMS test --- 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 0ef3317525b3..cd815d24dff9 100644 --- a/tests/python/frontend/tensorflow/test_forward.py +++ b/tests/python/frontend/tensorflow/test_forward.py @@ -3427,8 +3427,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")