tf.raw_ops.UnsortedSegmentJoin
Stay organized with collections
Save and categorize content based on your preferences.
Joins the elements of inputs
based on segment_ids
.
tf.raw_ops.UnsortedSegmentJoin(
inputs, segment_ids, num_segments, separator='', name=None
)
Computes the string join along segments of a tensor.
Given segment_ids
with rank N
and data
with rank N+M
:
`output[i, k1...kM] = strings.join([data[j1...jN, k1...kM])`
where the join is over all [j1...jN] such that segment_ids[j1...jN] = i.
Strings are joined in row-major order.
For example:
inputs = [['Y', 'q', 'c'], ['Y', '6', '6'], ['p', 'G', 'a']]
output_array = string_ops.unsorted_segment_join(inputs=inputs,
segment_ids=[1, 0, 1],
num_segments=2,
separator=':'))
# output_array ==> [['Y', '6', '6'], ['Y:p', 'q:G', 'c:a']]
inputs = ['this', 'is', 'a', 'test']
output_array = string_ops.unsorted_segment_join(inputs=inputs,
segment_ids=[0, 0, 0, 0],
num_segments=1,
separator=':'))
# output_array ==> ['this:is:a:test']
Args |
inputs
|
A Tensor of type string . The input to be joined.
|
segment_ids
|
A Tensor . Must be one of the following types: int32 , int64 .
A tensor whose shape is a prefix of data.shape. Negative segment ids are not
supported.
|
num_segments
|
A Tensor . Must be one of the following types: int32 , int64 .
A scalar.
|
separator
|
An optional string . Defaults to "" .
The separator to use when joining.
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor of type string .
|
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 2022-10-27 UTC.
[null,null,["Last updated 2022-10-27 UTC."],[],[],null,["# tf.raw_ops.UnsortedSegmentJoin\n\n\u003cbr /\u003e\n\nJoins the elements of `inputs` based on `segment_ids`.\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.raw_ops.UnsortedSegmentJoin`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/UnsortedSegmentJoin)\n\n\u003cbr /\u003e\n\n tf.raw_ops.UnsortedSegmentJoin(\n inputs, segment_ids, num_segments, separator='', name=None\n )\n\nComputes the string join along segments of a tensor.\nGiven `segment_ids` with rank `N` and `data` with rank `N+M`: \n\n `output[i, k1...kM] = strings.join([data[j1...jN, k1...kM])`\n\nwhere the join is over all \\[j1...jN\\] such that segment_ids\\[j1...jN\\] = i.\nStrings are joined in row-major order.\n\n#### For example:\n\n inputs = [['Y', 'q', 'c'], ['Y', '6', '6'], ['p', 'G', 'a']]\n output_array = string_ops.unsorted_segment_join(inputs=inputs,\n segment_ids=[1, 0, 1],\n num_segments=2,\n separator=':'))\n # output_array ==\u003e [['Y', '6', '6'], ['Y:p', 'q:G', 'c:a']]\n\n\n inputs = ['this', 'is', 'a', 'test']\n output_array = string_ops.unsorted_segment_join(inputs=inputs,\n segment_ids=[0, 0, 0, 0],\n num_segments=1,\n separator=':'))\n # output_array ==\u003e ['this:is:a:test']\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `inputs` | A `Tensor` of type `string`. The input to be joined. |\n| `segment_ids` | A `Tensor`. Must be one of the following types: `int32`, `int64`. A tensor whose shape is a prefix of data.shape. Negative segment ids are not supported. |\n| `num_segments` | A `Tensor`. Must be one of the following types: `int32`, `int64`. A scalar. |\n| `separator` | An optional `string`. Defaults to `\"\"`. The separator to use when joining. |\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 `Tensor` of type `string`. ||\n\n\u003cbr /\u003e"]]