PR #63398: Fix checkfail in UnicodeEncode Op
PR #63398: Fix checkfail in UnicodeEncode Op

Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/63398

The Op UnicodeEncode segfaults when passed 2D tensor to `input_splits`.

It has the below check in `SetShapeFn` which supposed to raise exception if `rank !=1` AFAIk. This seems not working for reason unknown to me.

https://github.com/tensorflow/tensorflow/blob/6f64ad5d767a034df45a5eaab8b36fd688cd1217/tensorflow/core/ops/string_ops.cc#L316-L317

Same with `input_values` argument also.
 
Added an explicit check in Op.

Ref issue #63379
Copybara import of the project:

--
176048ad39a1d928208b92e1503e2d8d2cd35d28 by Surya <116063290+SuryanarayanaY@users.noreply.github.com>:

Fix checkfail in UnicodeEncode Op

The Op UnicodeEncode segfaults when passed 2D tensor to `input_splits`.

It has the below check in SetShapeFn which supposed to raise exception if rank !=1 AFAIk. This seems not working for reason unknown to me.

https://github.com/tensorflow/tensorflow/blob/6f64ad5d767a034df45a5eaab8b36fd688cd1217/tensorflow/core/ops/string_ops.cc#L316-L317

Same with input_values argument also.
 
Added an explicit check in Op.

Merging this change closes #63398

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/63398 from tensorflow:Surya_UnicodeEncode 176048ad39a1d928208b92e1503e2d8d2cd35d28
