Skip to content

Commit

Permalink
Testcase check added to run in tf version above 1.15.0 & review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
siju-samuel committed Feb 25, 2020
1 parent e32831f commit 77e897f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,13 @@ def _test_reduce_any(data, keep_dims=None):
""" One iteration of reduce_any """
return _test_reduce(math_ops.reduce_any, data, keep_dims)


def _test_forward_reduce(testop, dtype="float32"):
def _test_forward_reduce(testop, dtype=None):
""" Reduce """
data0 = [np.random.rand(16, 16, 16, 16).astype(dtype), None]
data1 = [np.random.rand(16, 16, 16, 16).astype(dtype), np.array([1, 2], dtype=np.int32)]
data0 = [np.random.rand(16, 16, 16, 16).astype("float32"), None]
data1 = [np.random.rand(16, 16, 16, 16).astype("float32"), np.array([1, 2], dtype=np.int32)]
if dtype == 'bool':
data0[0] = (data0[0] < 0.5).astype(dtype)
data1[0] = (data1[0] < 0.5).astype(dtype)
testop(data0)
testop(data0, keep_dims=False)
testop(data0, keep_dims=True)
Expand All @@ -1132,7 +1134,8 @@ def test_all_reduce():
_test_forward_reduce_quantized(_test_reduce_mean)
_test_forward_reduce(_test_reduce_prod)
_test_forward_reduce(_test_reduce_sum)
_test_forward_reduce(_test_reduce_any, dtype="bool")
if package_version.parse(tf.VERSION) >= package_version.parse('1.15.0'):
_test_forward_reduce(_test_reduce_any, dtype="bool")


#######################################################################
Expand Down

0 comments on commit 77e897f

Please sign in to comment.