{ }
View source on GitHub |
Encodes each sequence of Unicode code points in input
into a string.
tf.strings.unicode_encode(
input,
output_encoding,
errors='replace',
replacement_char=65533,
name=None
)
Used in the notebooks
Used in the guide |
---|
result[i1...iN]
is the string formed by concatenating the Unicode
codepoints input[1...iN, :]
, encoded using output_encoding
.
Returns | |
---|---|
A N dimensional string tensor with shape [D1...DN] .
|
Example:
input = tf.ragged.constant(
[[71, 246, 246, 100, 110, 105, 103, 104, 116], [128522]])
print(unicode_encode(input, 'UTF-8'))
tf.Tensor([b'G\xc3\xb6\xc3\xb6dnight' b'\xf0\x9f\x98\x8a'],
shape=(2,), dtype=string)