Improve error message of strided slice op.

PiperOrigin-RevId: 340555916
Change-Id: I246fcc739feba88f03c1891175c0ba44bd03fee8
This commit is contained in:
Yunxing Dai 2020-11-03 17:24:17 -08:00 committed by TensorFlower Gardener
parent 6def0d4746
commit 1e228f57d2

View File

@ -223,12 +223,10 @@ class StridedSliceOp : public XlaOpKernel {
input_elements_sliced *= input_shape.dim_size(d); input_elements_sliced *= input_shape.dim_size(d);
} }
OP_REQUIRES( OP_REQUIRES(ctx, output_elements == input_elements_sliced,
ctx, output_elements == input_elements_sliced, errors::InvalidArgument(
errors::InvalidArgument( "Dynamic indices of strided_slice_op have to be leading "
"The number of output elements ", output_elements, "dimensions in the indices list."));
" has to equal to number of input elements that are sliced ",
input_elements_sliced, " when input indices are not constant."));
for (int64 i = 0; i < ctx->InputShape("begin").dims(); ++i) { for (int64 i = 0; i < ctx->InputShape("begin").dims(); ++i) {
OP_REQUIRES( OP_REQUIRES(