Skip to content
Permalink
Browse files Browse the repository at this point in the history
Ensure non-empty input_splits in tf.raw_ops.UnicodeEncode
PiperOrigin-RevId: 387170080
Change-Id: I3b489acc51c5cb4124c535b9df7cc6e62ef21766
  • Loading branch information
pak-laura authored and tensorflower-gardener committed Jul 27, 2021
1 parent 9c87c32 commit 2e0ee46
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tensorflow/core/kernels/unicode_ops.cc
Expand Up @@ -533,6 +533,10 @@ class UnicodeEncodeOp : public OpKernel {
const Tensor& input_splits = context->input(1);
const auto input_splits_flat = input_splits.flat<SPLITS_TYPE>();

OP_REQUIRES(
context, input_splits.NumElements() > 0,
errors::InvalidArgument("Input_splits should contain elements, but "
"given input_values has 0 elements"));
// Operation will treat first argument in input_splits as if it were zero
// regardless of its actual value since splits should begin with zero and
// end with the length of the input values vector.
Expand Down

0 comments on commit 2e0ee46

Please sign in to comment.