diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-08-27 09:34:14 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-27 09:38:36 -0700 |
commit | 176781dca8a310095d00658679a9e4b132bc92a7 (patch) | |
tree | fbaa2bd9309c470a2a2980a5f7fa8ade4fc5cc44 /tensorflow | |
parent | 1022de8a575718f8421549572684f879ffa33bce (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')
-rw-r--r-- | tensorflow/compiler/tests/slice_ops_test.py | 13 | ||||
-rw-r--r-- | tensorflow/docs_src/performance/xla/operation_semantics.md | 2 |
2 files changed, 14 insertions, 1 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(): diff --git a/tensorflow/docs_src/performance/xla/operation_semantics.md b/tensorflow/docs_src/performance/xla/operation_semantics.md index c23a7ad9e2..96d269bec4 100644 --- a/tensorflow/docs_src/performance/xla/operation_semantics.md +++ b/tensorflow/docs_src/performance/xla/operation_semantics.md @@ -2266,7 +2266,7 @@ arguments to the slice operation. | `limit_indices` | `ArraySlice<int64>` | List of N integers containing the | : : : ending indices (exclusive) for the : : : : slice for each dimension. Each value : -: : : must be strictly greater than the : +: : : must be greater than or equal to the : : : : respective `start_indices` value for : : : : the dimension and less than or equal : : : : to the size of the dimension. : |