Concatenates a list of `SparseTensor` along the specified dimension.
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 ]
Constants
String | OP_NAME | The name of this op, as known by TensorFlow core engine |
Public Methods
static <T extends TType> SparseConcat<T> | |
Output<TInt64> |
outputIndices()
2-D.
|
Output<TInt64> |
outputShape()
1-D.
|
Output<T> |
outputValues()
1-D.
|
Inherited Methods
Constants
public static final String OP_NAME
The name of this op, as known by TensorFlow core engine
Public Methods
public static SparseConcat<T> create (Scope scope, Iterable<Operand<TInt64>> indices, Iterable<Operand<T>> values, Iterable<Operand<TInt64>> shapes, Long concatDim)
Factory method to create a class wrapping a new SparseConcat operation.
Parameters
scope | current scope |
---|---|
indices | 2-D. Indices of each input `SparseTensor`. |
values | 1-D. Non-empty values of each `SparseTensor`. |
shapes | 1-D. Shapes of each `SparseTensor`. |
concatDim | Dimension to concatenate along. Must be in range [-rank, rank), where rank is the number of dimensions in each input `SparseTensor`. |
Returns
- a new instance of SparseConcat