# tensorflow::ops::SparseConcat

`#include <sparse_ops.h>`

Concatenates a list of `SparseTensor` along the specified dimension.

## Summary

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](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/all#classtensorflow_1_1ops_1_1_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"
```

<br />

then the output will be

```
shape = [2, 7]
[0, 2]: "a"
[0, 4]: "d"
[0, 5]: "e"
[1, 0]: "b"
[1, 1]: "c"
```

<br />

Graphically this is equivalent to doing

```
[    a] concat [  d e  ] = [    a   d e  ]
[b c  ]        [       ]   [b c          ]
```

<br />

Arguments:

- scope: A [Scope](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- indices: 2-D. Indices of each input `SparseTensor`.
- values: 1-D. Non-empty values of each `SparseTensor`.
- shapes: 1-D. Shapes of each `SparseTensor`.
- concat_dim: Dimension to concatenate along. Must be in range \[-rank, rank), where rank is the number of dimensions in each input `SparseTensor`.

<br />

Returns:

- `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` output_indices: 2-D. Indices of the concatenated `SparseTensor`.
- `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` output_values: 1-D. Non-empty values of the concatenated `SparseTensor`.
- `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` output_shape: 1-D. Shape of the concatenated `SparseTensor`.

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-concat#classtensorflow_1_1ops_1_1_sparse_concat_1a50aa275ec5a88496fd4e99f0f1003616(const ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list indices, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list values, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input-list#classtensorflow_1_1_input_list shapes, int64 concat_dim)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-concat#classtensorflow_1_1ops_1_1_sparse_concat_1a8db5a398751bcf0e460c5032ae1ab292` | `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-concat#classtensorflow_1_1ops_1_1_sparse_concat_1a79b9cef174b8488e90f52907d6d64a0f` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-concat#classtensorflow_1_1ops_1_1_sparse_concat_1ae3130991367ac10382b9a6a310b1eff5` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/sparse-concat#classtensorflow_1_1ops_1_1_sparse_concat_1a626bd96bc86fb8ecddbd8cbb7a6828cf` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

## Public attributes

### operation

```
Operation operation
```

### output_indices

```
::tensorflow::Output output_indices
```

### output_shape

```
::tensorflow::Output output_shape
```

### output_values

```
::tensorflow::Output output_values
```

## Public functions

### SparseConcat

```
 SparseConcat(
  const ::tensorflow::Scope & scope,
  ::tensorflow::InputList indices,
  ::tensorflow::InputList values,
  ::tensorflow::InputList shapes,
  int64 concat_dim
)
```