diff options
author | 2018-03-09 13:24:23 -0800 | |
---|---|---|
committer | 2018-03-09 13:28:21 -0800 | |
commit | 4c686715368a87c2490fc2041f2d828c59170ce9 (patch) | |
tree | 29a4238a72f8066673cb0868cf10bc9f09ab0e4d /tensorflow/contrib/lite/kernels/strided_slice_test.cc | |
parent | ff783fe97e25cb901395eb8ae8746ca5c56bca39 (diff) |
Internal Change
PiperOrigin-RevId: 188528771
Diffstat (limited to 'tensorflow/contrib/lite/kernels/strided_slice_test.cc')
-rw-r--r-- | tensorflow/contrib/lite/kernels/strided_slice_test.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/kernels/strided_slice_test.cc b/tensorflow/contrib/lite/kernels/strided_slice_test.cc index 5cac04b383..5c98c5f431 100644 --- a/tensorflow/contrib/lite/kernels/strided_slice_test.cc +++ b/tensorflow/contrib/lite/kernels/strided_slice_test.cc @@ -522,6 +522,28 @@ TEST(StridedSliceOpTest, In3D_IdentityShrinkAxis7) { EXPECT_TRUE(m.GetOutputShape().empty()); EXPECT_THAT(m.GetOutput(), ElementsAreArray({1})); } + +// This tests catches a very subtle bug that was fixed by cl/188403234. +TEST(StridedSliceOpTest, RunTwice) { + StridedSliceOpModel m({2, 3}, {2}, {2}, {2}, 1, 0, 0, 0, 0); + + auto setup_inputs = [&m]() { + m.SetInput({1, 2, 3, 4, 5, 6}); + m.SetBegin({1, 0}); + m.SetEnd({2, 2}); + m.SetStrides({1, 1}); + }; + + setup_inputs(); + m.Invoke(); + EXPECT_THAT(m.GetOutput(), ElementsAreArray({1, 2, 4, 5})); + + setup_inputs(); + m.Invoke(); + // Prior to cl/188403234 this was {4, 5}. + EXPECT_THAT(m.GetOutput(), ElementsAreArray({1, 2, 4, 5})); +} + } // namespace } // namespace tflite |