tf.strings.join
Stay organized with collections
Save and categorize content based on your preferences.
Perform element-wise concatenation of a list of string tensors.
tf.strings.join(
inputs, separator='', name=None
)
Used in the notebooks
Used in the guide |
Used in the tutorials |
|
|
Given a list of string tensors of same shape, performs element-wise
concatenation of the strings of the same index in all tensors.
tf.strings.join(['abc','def']).numpy()
b'abcdef'
tf.strings.join([['abc','123'],
['def','456'],
['ghi','789']]).numpy()
array([b'abcdefghi', b'123456789'], dtype=object)
tf.strings.join([['abc','123'],
['def','456']],
separator=" ").numpy()
array([b'abc def', b'123 456'], dtype=object)
The reduction version of this elementwise operation is
tf.strings.reduce_join
Args |
inputs
|
A list of tf.Tensor objects of same size and tf.string dtype.
|
separator
|
A string added between each string being joined.
|
name
|
A name for the operation (optional).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.strings.join\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/string_ops.py#L551-L583) |\n\nPerform element-wise concatenation of a list of string tensors.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.string_join`](https://www.tensorflow.org/api_docs/python/tf/strings/join), [`tf.compat.v1.strings.join`](https://www.tensorflow.org/api_docs/python/tf/strings/join)\n\n\u003cbr /\u003e\n\n tf.strings.join(\n inputs, separator='', name=None\n )\n\n### Used in the notebooks\n\n| Used in the guide | Used in the tutorials |\n|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - [Ragged tensors](https://www.tensorflow.org/guide/ragged_tensor) | - [Text generation with an RNN](https://www.tensorflow.org/text/tutorials/text_generation) - [Sending Different Data To Particular Clients With tff.federated_select](https://www.tensorflow.org/federated/tutorials/federated_select) - [Client-efficient large-model federated learning via \\`federated_select\\` and sparse aggregation](https://www.tensorflow.org/federated/tutorials/sparse_federated_learning) - [Image captioning with visual attention](https://www.tensorflow.org/text/tutorials/image_captioning) - [Neural machine translation with attention](https://www.tensorflow.org/text/tutorials/nmt_with_attention) |\n\nGiven a list of string tensors of same shape, performs element-wise\nconcatenation of the strings of the same index in all tensors. \n\n tf.strings.join(['abc','def']).numpy()\n b'abcdef'\n tf.strings.join([['abc','123'],\n ['def','456'],\n ['ghi','789']]).numpy()\n array([b'abcdefghi', b'123456789'], dtype=object)\n tf.strings.join([['abc','123'],\n ['def','456']],\n separator=\" \").numpy()\n array([b'abc def', b'123 456'], dtype=object)\n\nThe reduction version of this elementwise operation is\n[`tf.strings.reduce_join`](../../tf/strings/reduce_join)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|---------------------------------------------------------------------------------------------------------|\n| `inputs` | A list of [`tf.Tensor`](../../tf/Tensor) objects of same size and [`tf.string`](../../tf#string) dtype. |\n| `separator` | A string added between each string being joined. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A [`tf.string`](../../tf#string) tensor. ||\n\n\u003cbr /\u003e"]]