From 794e03acf07a0ae6f4228170203f30f40f5b28cb Mon Sep 17 00:00:00 2001 From: "xiaolong.zhu" Date: Wed, 4 Aug 2021 19:05:40 +0800 Subject: [PATCH] [TF] Support TensorFlow < 1.13 for test_sparse_add --- 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)