W3cubDocs

/TensorFlow 2.3

tf.strings.reduce_join

View source on GitHub

Joins all strings into a single string, or joins along an axis.

tf.strings.reduce_join([['abc','123'],
                        ['def','456']]).numpy()
b'abc123def456'
tf.strings.reduce_join([['abc','123'],
                        ['def','456']], axis=-1).numpy()
array([b'abc123', b'def456'], dtype=object)
tf.strings.reduce_join([['abc','123'],
                        ['def','456']],
                       axis=-1,
                       separator=" ").numpy()
array([b'abc 123', b'def 456'], dtype=object)
Args
inputs A tf.string tensor.
axis Which axis to join along. The default behavior is to join all elements, producing a scalar.
keepdims If true, retains reduced dimensions with length 1.
separator a string added between each string being joined.
name A name for the operation (optional).
Returns
A tf.string tensor.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/strings/reduce_join