aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/tests
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-08-27 09:34:14 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-27 09:38:36 -0700
commit176781dca8a310095d00658679a9e4b132bc92a7 (patch)
treefbaa2bd9309c470a2a2980a5f7fa8ade4fc5cc44 /tensorflow/compiler/tests
parent1022de8a575718f8421549572684f879ffa33bce (diff)
[TF:XLA] Test zero element slice and update documentation.
Documentation previously disallowed slices where start and limit indices were the same, but it was allowed by the implementation. Updated the documentation to support the implementation. PiperOrigin-RevId: 210379434
Diffstat (limited to 'tensorflow/compiler/tests')
-rw-r--r--tensorflow/compiler/tests/slice_ops_test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/compiler/tests/slice_ops_test.py b/tensorflow/compiler/tests/slice_ops_test.py
index 8f10c2fe86..2c611a959e 100644
--- a/tensorflow/compiler/tests/slice_ops_test.py
+++ b/tensorflow/compiler/tests/slice_ops_test.py
@@ -40,6 +40,19 @@ class SliceTest(xla_test.XLATestCase):
self.assertAllEqual([2, 3, 4, 5], result)
+ def testZeroSlice(self):
+ for dtype in self.numeric_types:
+ with self.cached_session():
+ i = array_ops.placeholder(dtype, shape=[2])
+ with self.test_scope():
+ o = array_ops.slice(i, [0], [0])
+ params = {
+ i: [0, 1],
+ }
+ result = o.eval(feed_dict=params)
+
+ self.assertAllEqual([], result)
+
def test3D(self):
for dtype in self.numeric_types:
with self.cached_session():