Skip to content

Commit 4996b10

Browse files
committed
add slice test for size = -1
1 parent ffe6792 commit 4996b10

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_backend.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,15 @@ def test_slice(self):
10471047
_ = tf.identity(x_, name=_TFOUTPUT)
10481048
self._run_test_case([_OUTPUT], {_INPUT: x_val})
10491049

1050+
def test_slice_neg_size(self):
1051+
x_val = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float32)
1052+
t1 = tf.constant([0, 1], dtype=tf.int32)
1053+
t2 = tf.constant([-1, 2], dtype=tf.int32)
1054+
x0 = tf.placeholder(tf.float32, x_val.shape, name=_TFINPUT)
1055+
x_ = tf.slice(x0, t1, t2)
1056+
_ = tf.identity(x_, name=_TFOUTPUT)
1057+
self._run_test_case([_OUTPUT], {_INPUT: x_val})
1058+
10501059
@check_opset_min_version(10, "Slice in opset 10 can accept dymaic 'start' and 'ends'")
10511060
def test_slice_with_non_const(self):
10521061
x_val = np.array([[1, 2, 3, 4], [5, 6, 7, 8]], dtype=np.float32)

0 commit comments

Comments
 (0)