inadob commented on a change in pull request #4502: [Relay][Frontend][TFlite]
Add parses support for SLICE
URL: https://github.com/apache/incubator-tvm/pull/4502#discussion_r357715907
##########
File path: tests/python/frontend/tflite/test_forward.py
##########
@@ -219,6 +219,26 @@ def test_forward_split():
_test_split((1, 3, 6, 5), -2, 3, 'float32')
_test_split((1, 3, 5, 6), -1, 3, 'float32')
+#######################################################################
+# slice
+# -----
+
+def _test_slice(data, begin, size):
+ """ One iteration of SLICE """
+ with tf.Graph().as_default():
+ in_data = array_ops.placeholder(shape=data.shape, dtype=data.dtype)
+ out = array_ops.slice(in_data, begin, size)
+ compare_tflite_with_tvm(data, 'Placeholder:0', [in_data], [out])
+
+def test_forward_slice():
+ """ SLICE """
+ _test_slice(np.arange(4, dtype=np.float32).reshape((4, )), begin=[0],
size=[2])
+ _test_slice(np.arange(18, dtype=np.int32).reshape((3, 2, 3)), begin=[1, 0,
0], size=[1, 1, 3])
+ # tflite 1.13 outputs nonsense values if size[i] == -1
+ if package_version.parse(tf.VERSION) >= package_version.parse('1.14.0'):
+ _test_slice(np.arange(8, dtype=np.int32).reshape((2, 4)), begin=[0,
1], size=[-1, -1])
Review comment:
The PR fixing the TF parser is ready: #4518
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services