TakeManySparseFromTensorsMap
tensorflow C++ API
tensorflow::ops::TakeManySparseFromTensorsMap
ReadSparseTensors
from aSparseTensorsMap
and concatenate them.
Summary
The inputsparse_handles
must be anint64
matrix of shape[N, 1]
whereN
is the minibatch size and the rows correspond to the output handles ofAddSparseToTensorsMap
orAddManySparseToTensorsMap
. The ranks of the originalSparseTensor
objects that went into the given input ops must all match. When the finalSparseTensor
is created, it has rank one higher than the ranks of the incomingSparseTensor
objects (they have been concatenated along a new row dimension on the left).
The outputSparseTensor
object’s shape values for all dimensions but the first are the max across the inputSparseTensor
objects’ shape values for the corresponding dimensions. Its first shape value isN
, the minibatch size.
The inputSparseTensor
objects’ indices are assumed ordered in standard lexicographic order. If this is not the case, after this step runSparseReorder
to restore index ordering.
For example, if the handles represent an input, which is a[2, 3]
matrix representing two originalSparseTensor
objects:
``` index = [ 0] [10] [20] values = [1, 2, 3] shape = [50] ```
and
``` index = [ 2] [10] values = [4, 5] shape = [30] ```
then the finalSparseTensor
will be:
``` index = [0 0] [0 10] [0 20] [1 2] [1 10] values = [1, 2, 3, 4, 5] shape = [2 50] ```
Arguments:
- scope: A Scopeobject
- sparse_handles: 1-D, The
N
serializedSparseTensor
objects.Shape:[N]
. - dtype: The
dtype
of theSparseTensor
objects stored in theSparseTensorsMap
.
Optional attributes (seeAttrs
):
- container: The container name for the
SparseTensorsMap
read by this op. - shared_name: The shared name for the
SparseTensorsMap
read by this op. It should not be blank; rather theshared_name
or uniqueOperation name of the Op that created the originalSparseTensorsMap
should be used.
Returns:
Output
sparse_indices: 2-D. Theindices
of the minibatchSparseTensor
.Output
sparse_values: 1-D. Thevalues
of the minibatchSparseTensor
.Output
sparse_shape: 1-D. Theshape
of the minibatchSparseTensor
.
TakeManySparseFromTensorsMap block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_sparse.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input sparse_handles: connect Input node.
- Input output_shape: connect Input node.
- Datatype dtype : Input DataType in value ex)DT_FLOAT;
- TakeManySparseFromTensorsMap ::Attrs attrs : Input attrs in value. ex) container_ =;shared_name_ =AB;
Return:
- Output sparse_indices: Output object of TakeManySparseFromTensorsMap class object.
- Output sparse_values: Output object of TakeManySparseFromTensorsMap class object.
- Output sparse_shape: Output object of TakeManySparseFromTensorsMap class object.
Result:
- std::vector(Tensor) result_sparse_indices : Returned object of executed result by calling session.
- std::vector(Tensor) result_sparse_values : Returned object of executed result by calling session.
- std::vector(Tensor) result_output_shape : Returned object of executed result by calling session.