From 8d91a222b506c4a1c9a1fde9eb66a8251e01828b Mon Sep 17 00:00:00 2001 From: Josh Fromm Date: Thu, 8 Jul 2021 21:42:31 +0000 Subject: [PATCH] Add test against golden array. --- tests/python/frontend/onnx/test_forward.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/python/frontend/onnx/test_forward.py b/tests/python/frontend/onnx/test_forward.py index 4557afe752ac..48aff78044bd 100644 --- a/tests/python/frontend/onnx/test_forward.py +++ b/tests/python/frontend/onnx/test_forward.py @@ -4913,6 +4913,24 @@ def test_random_uniform(): vals_2 = get_random_uniform(shape=[10], seed=1) assert all(vals_1 == vals_2) + # Test against an expected output with a fixed seed. + real = get_random_uniform(shape=[10], seed=5) + expected = np.asarray( + [ + 0.8614111, + 0.46572232, + 0.6007328, + 0.21619737, + 0.6361222, + 0.7298056, + 0.13094282, + 0.03556716, + 0.32997167, + 0.2977605, + ] + ) + tvm.testing.assert_allclose(real, expected, rtol=1e-5) + if __name__ == "__main__": test_flatten()