Fixed bug in tf.strings.unicode_decode where rank > ragged_rank + 1.
PiperOrigin-RevId: 299188662 Change-Id: I8b855776dcb13ca492044dc312fb6621ef39edc8
This commit is contained in:
parent
244a9b0a41
commit
88ba403d7f
|
@ -126,6 +126,8 @@ class UnicodeDecodeTest(test_util.TensorFlowTestCase,
|
|||
{"texts": [["Hi", "there"], ["", u"\U0001f60a"]], "ragged_rank": 0},
|
||||
{"texts": [["Hi", "there", ""], [u"😊"]], "ragged_rank": 1},
|
||||
{"texts": [[[u"😊", u"🤠🧐"], []], [[u"🤓👻🤖"]]], "ragged_rank": 2},
|
||||
{"texts": [[[u"😊"], [u"🤠🧐"]], [[u"🤓👻🤖"]]], "ragged_rank": 1},
|
||||
{"texts": [[[u"😊"], [u"🤠🧐"]], [[u"🤓"], [u"👻"]]], "ragged_rank": 0},
|
||||
{"texts": []}
|
||||
]) # pyformat: disable
|
||||
def testBasicDecode(self, texts, ragged_rank=None):
|
||||
|
|
|
@ -411,7 +411,7 @@ def _unicode_decode(input, input_encoding, errors, replacement_char,
|
|||
input = input.with_flat_values(
|
||||
ragged_tensor.RaggedTensor.from_tensor(
|
||||
input.flat_values,
|
||||
ragged_rank=input_ndims - input.ragged_rank + 1))
|
||||
ragged_rank=input_ndims - input.ragged_rank - 1))
|
||||
|
||||
# Reshape the input to a flat vector, and apply the gen_string_ops op.
|
||||
if ragged_tensor.is_ragged(input):
|
||||
|
|
Loading…
Reference in New Issue