View source on GitHub |
Decodes each string in input
into a sequence of Unicode code points.
tf.strings.unicode_decode(
input,
input_encoding,
errors='replace',
replacement_char=65533,
replace_control_characters=False,
name=None
)
result[i1...iN, j]
is the Unicode codepoint for the j
th character in
input[i1...iN]
, when decoded using input_encoding
.
Returns | |
---|---|
A N+1 dimensional int32 tensor with shape [D1...DN, (num_chars)] .
The returned tensor is a tf.Tensor if input is a scalar, or a
tf.RaggedTensor otherwise.
|
Example:
input = [s.encode('utf8') for s in (u'G\xf6\xf6dnight', u'\U0001f60a')]
tf.strings.unicode_decode(input, 'UTF-8').to_list()
[[71, 246, 246, 100, 110, 105, 103, 104, 116], [128522]]