tf.raw_ops.SparseConcat
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Concatenates a list of SparseTensor
along the specified dimension.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.raw_ops.SparseConcat
tf.raw_ops.SparseConcat(
indices, values, shapes, concat_dim, name=None
)
Concatenation is with respect to the dense versions of these sparse tensors.
It is assumed that each input is a SparseTensor
whose elements are ordered
along increasing dimension number.
All inputs' shapes must match, except for the concat dimension. The
indices
, values
, and shapes
lists must have the same length.
The output shape is identical to the inputs', except along the concat
dimension, where it is the sum of the inputs' sizes along that dimension.
The output elements will be resorted to preserve the sort order along
increasing dimension number.
This op runs in O(M log M)
time, where M
is the total number of non-empty
values across all inputs. This is due to the need for an internal sort in
order to concatenate efficiently across an arbitrary dimension.
For example, if concat_dim = 1
and the inputs are
sp_inputs[0]: shape = [2, 3]
[0, 2]: "a"
[1, 0]: "b"
[1, 1]: "c"
sp_inputs[1]: shape = [2, 4]
[0, 1]: "d"
[0, 2]: "e"
then the output will be
shape = [2, 7]
[0, 2]: "a"
[0, 4]: "d"
[0, 5]: "e"
[1, 0]: "b"
[1, 1]: "c"
Graphically this is equivalent to doing
[ a] concat [ d e ] = [ a d e ]
[b c ] [ ] [b c ]
Args |
indices
|
A list of at least 2 Tensor objects with type int64 .
2-D. Indices of each input SparseTensor .
|
values
|
A list with the same length as indices of Tensor objects with the same type.
1-D. Non-empty values of each SparseTensor .
|
shapes
|
A list with the same length as indices of Tensor objects with type int64 .
1-D. Shapes of each SparseTensor .
|
concat_dim
|
An int .
Dimension to concatenate along. Must be in range [-rank, rank),
where rank is the number of dimensions in each input SparseTensor .
|
name
|
A name for the operation (optional).
|
Returns |
A tuple of Tensor objects (output_indices, output_values, output_shape).
|
output_indices
|
A Tensor of type int64 .
|
output_values
|
A Tensor . Has the same type as values .
|
output_shape
|
A Tensor of type int64 .
|
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.
Last updated 2020-10-01 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 2020-10-01 UTC."],[],[],null,["# tf.raw_ops.SparseConcat\n\n\u003cbr /\u003e\n\nConcatenates a list of `SparseTensor` along the specified dimension.\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.SparseConcat`](/api_docs/python/tf/raw_ops/SparseConcat)\n\n\u003cbr /\u003e\n\n tf.raw_ops.SparseConcat(\n indices, values, shapes, concat_dim, name=None\n )\n\nConcatenation is with respect to the dense versions of these sparse tensors.\nIt is assumed that each input is a `SparseTensor` whose elements are ordered\nalong increasing dimension number.\n\nAll inputs' shapes must match, except for the concat dimension. The\n`indices`, `values`, and `shapes` lists must have the same length.\n\nThe output shape is identical to the inputs', except along the concat\ndimension, where it is the sum of the inputs' sizes along that dimension.\n\nThe output elements will be resorted to preserve the sort order along\nincreasing dimension number.\n\nThis op runs in `O(M log M)` time, where `M` is the total number of non-empty\nvalues across all inputs. This is due to the need for an internal sort in\norder to concatenate efficiently across an arbitrary dimension.\n\nFor example, if `concat_dim = 1` and the inputs are \n\n sp_inputs[0]: shape = [2, 3]\n [0, 2]: \"a\"\n [1, 0]: \"b\"\n [1, 1]: \"c\"\n\n sp_inputs[1]: shape = [2, 4]\n [0, 1]: \"d\"\n [0, 2]: \"e\"\n\nthen the output will be \n\n shape = [2, 7]\n [0, 2]: \"a\"\n [0, 4]: \"d\"\n [0, 5]: \"e\"\n [1, 0]: \"b\"\n [1, 1]: \"c\"\n\nGraphically this is equivalent to doing \n\n [ a] concat [ d e ] = [ a d e ]\n [b c ] [ ] [b c ]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| `indices` | A list of at least 2 `Tensor` objects with type `int64`. 2-D. Indices of each input `SparseTensor`. |\n| `values` | A list with the same length as `indices` of `Tensor` objects with the same type. 1-D. Non-empty values of each `SparseTensor`. |\n| `shapes` | A list with the same length as `indices` of `Tensor` objects with type `int64`. 1-D. Shapes of each `SparseTensor`. |\n| `concat_dim` | An `int`. Dimension to concatenate along. Must be in range \\[-rank, rank), where rank is the number of dimensions in each input `SparseTensor`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|------------------|--------------------------------------------|\n| A tuple of `Tensor` objects (output_indices, output_values, output_shape). ||\n| `output_indices` | A `Tensor` of type `int64`. |\n| `output_values` | A `Tensor`. Has the same type as `values`. |\n| `output_shape` | A `Tensor` of type `int64`. |\n\n\u003cbr /\u003e"]]