tf.compat.v1.reduce_join
Объединяет все строки в одну строку или объединяет по оси.
tf.compat.v1.reduce_join(
inputs, axis=None, keep_dims=None, separator='', name=None,
reduction_indices=None, keepdims=None
)
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)
| Аргументы | |
|---|---|
inputs | A tf.string tensor. |
axis | Ось для объединения. По умолчанию объединяются все элементы, что даёт скалярное значение. |
keepdims | Если True, сохраняются уменьшенные размерности длиной 1. |
separator | Строка, добавляемая между каждой объединяемой строкой. |
name | Имя операции (необязательно). |
| Возвращаемое значение | |
|---|---|
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/compat/v1/reduce_join