[XLA] Improve shape inference error messages for DynamicSlice/DynamicUpdateSlice.

PiperOrigin-RevId: 157461335
This commit is contained in:
A. Unique TensorFlower 2017-05-30 07:28:40 -07:00 committed by TensorFlower Gardener
parent 8c2a079ec8
commit f7ca8db7d8

View File

@ -1087,9 +1087,11 @@ ShapeInference::InferDegenerateDimensionBroadcastShape(
const int64 start_num_dims = start_indices_shape.dimensions(0);
if (ShapeUtil::Rank(operand_shape) != start_num_dims) {
return InvalidArgument(
"dynamic slice start number of dimensions %lld must match rank %lld of "
"slice input",
start_num_dims, ShapeUtil::Rank(operand_shape));
"dynamic slice start number of dimensions %lld (%s) must match rank "
"%lld of slice input (%s)",
start_num_dims, ShapeUtil::HumanString(start_indices_shape).c_str(),
ShapeUtil::Rank(operand_shape),
ShapeUtil::HumanString(operand_shape).c_str());
}
if (slice_sizes.size() != ShapeUtil::Rank(operand_shape)) {
@ -1148,9 +1150,11 @@ ShapeInference::InferDegenerateDimensionBroadcastShape(
const int64 start_num_dims = start_indices_shape.dimensions(0);
if (ShapeUtil::Rank(operand_shape) != start_num_dims) {
return InvalidArgument(
"dynamic update slice start number of dimensions %lld must match "
"rank %lld of slice input",
start_num_dims, ShapeUtil::Rank(operand_shape));
"dynamic slice start number of dimensions %lld (%s) must match rank "
"%lld of slice input (%s)",
start_num_dims, ShapeUtil::HumanString(start_indices_shape).c_str(),
ShapeUtil::Rank(operand_shape),
ShapeUtil::HumanString(operand_shape).c_str());
}
if (ShapeUtil::Rank(update_shape) != ShapeUtil::Rank(operand_shape)) {