yongwww commented on a change in pull request #4372: [Relay][Frontend][TF] Fix
slice when begin or size is not Const
URL: https://github.com/apache/incubator-tvm/pull/4372#discussion_r348084671
##########
File path: tests/python/frontend/tensorflow/test_forward.py
##########
@@ -2188,6 +2188,20 @@ def test_forward_transpose():
_test_forward_tranapose_axes_input((2, 3, 4, 5), (3, 0, 1, 2))
+def _test_forward_slice_operation_input(input_value, begin_value, size_value):
+ input_data = np.array(input_value, dtype=np.float32)
+ with tf.Graph().as_default():
+ input_tensor = tf.placeholder(
+ shape=input_data.shape, dtype=input_data.dtype, name="input")
+ begin_tensor = tf.expand_dims(begin_value, axis=0)
+ size_tensor = tf.expand_dims(size_value, axis=0)
+ slice_tensor = tf.slice(input_tensor, begin_tensor, size_tensor,
name='slice_output')
+ compare_tf_with_tvm([input_data], ['input:0'], 'slice_output:0')
+
+
+def test_forward_slice():
+ _test_forward_slice_operation_input([1, 1], 0, 2)
Review comment:
add test cases to cover begin & size as tensor
----------------------------------------------------------------
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