aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/shape_inference_test.cc
diff options
context:
space:
mode:
authorGravatar Chris Leary <leary@google.com>2018-01-26 11:32:38 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-26 11:36:45 -0800
commitde946383a20ca5aada87dd4ca956371ec4a743b2 (patch)
tree38708906349c08640308b8c50199472691bf9778 /tensorflow/compiler/xla/service/shape_inference_test.cc
parentc99daaf104105a4e711d91dca8c73c1badecbe5f (diff)
[XLA] Improve error message for bad slices.
PiperOrigin-RevId: 183420038
Diffstat (limited to 'tensorflow/compiler/xla/service/shape_inference_test.cc')
-rw-r--r--tensorflow/compiler/xla/service/shape_inference_test.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/shape_inference_test.cc b/tensorflow/compiler/xla/service/shape_inference_test.cc
index 99d87f3b55..026c021165 100644
--- a/tensorflow/compiler/xla/service/shape_inference_test.cc
+++ b/tensorflow/compiler/xla/service/shape_inference_test.cc
@@ -1512,5 +1512,20 @@ TEST_F(ShapeInferenceTest, Conditional) {
"must have the same shape"));
}
+TEST_F(ShapeInferenceTest, BadSlice) {
+ auto arg = ShapeUtil::MakeShape(F32, {4});
+ StatusOr<Shape> statusor =
+ ShapeInference::InferSliceShape(arg, {0}, {5}, {1});
+ ASSERT_FALSE(statusor.ok());
+
+ LOG(INFO) << statusor.status();
+
+ EXPECT_THAT(statusor.status().error_message(),
+ HasSubstr("less than or equal to dimension size"))
+ << statusor.status();
+ EXPECT_THAT(statusor.status().error_message(), HasSubstr("argument shape"))
+ << statusor.status();
+}
+
} // namespace
} // namespace xla