From 1a95f9bd0e84c4f3ebcbd668f26631fd74e8f28f Mon Sep 17 00:00:00 2001 From: xiaolong18 <88359882+xiaolong18@users.noreply.github.com> Date: Mon, 16 Aug 2021 04:43:52 +0800 Subject: [PATCH] [TF] Support TensorFlow < 1.13 for test_sparse_add (#8647) --- tests/python/frontend/tensorflow/test_forward.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/python/frontend/tensorflow/test_forward.py b/tests/python/frontend/tensorflow/test_forward.py index 6733b326c395..51c2414f14a1 100644 --- a/tests/python/frontend/tensorflow/test_forward.py +++ b/tests/python/frontend/tensorflow/test_forward.py @@ -2511,9 +2511,15 @@ def _test_sparse_add(indices, values, A_shape, B_shape, dtype, flip=False): # TODO(ANSHUMAN87): support user input threashold values if flip: - result = tf.sparse.add(B, A_sp, threshold=0) + if package_version.parse(tf.VERSION) < package_version.parse("1.13.0"): + result = tf.sparse.add(B, A_sp, thresh=0) + else: + result = tf.sparse.add(B, A_sp, threshold=0) else: - result = tf.sparse.add(A_sp, B, threshold=0) + if package_version.parse(tf.VERSION) < package_version.parse("1.13.0"): + result = tf.sparse.add(A_sp, B, thresh=0) + else: + result = tf.sparse.add(A_sp, B, threshold=0) B_np = np.random.uniform(high=5.0, size=B_shape).astype(dtype)