Link Search Menu Expand Document

SparseSplit


tensorflow C++ API

tensorflow::ops::SparseSplit

Split a SparseTensor into num_split tensors along one dimension.


Summary

If the shape[split_dim] is not an integer multiple of num_split. Slices [0 : shape[split_dim] % num_split] gets one extra dimension. For example, if split_dim = 1 and num_split = 2 and the input is

input_tensor = shape =[2,7]
[    a   d e  ]
[b c          ]

Graphically the output tensors are:

output_tensor[0]= shape =[2,4]
[    a  ]
[b c    ]

output_tensor[1]= shape=[2,3]
[d e  ]
[     ]

Arguments:

  • scope: A Scope object
  • split_dim: 0-D. The dimension along which to split. Must be in the range [0, rank(shape)).
  • indices: 2-D tensor represents the indices of the sparse tensor.
  • values: 1-D tensor represents the values of the sparse tensor.
  • shape: 1-D. tensor represents the shape of the sparse tensor. output indices: A list of 1-D tensors represents the indices of the output sparse tensors.
  • num_split: The number of ways to split.

Returns:

  • OutputList output_indices
  • OutputList output_values: A list of 1-D tensors represents the values of the output sparse tensors.
  • OutputList output_shape: A list of 1-D tensors represents the shape of the output sparse tensors.

SparseSplit 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 split_dim : connect Input node.
  • Input indices: connect Input node.
  • Input values: connect Input node.
  • Input shape: connect Input node.
  • int64 num_split: input int64 in value.

Return:

  • OutputList output_indices: Output object of SparseSplit class object.
  • OutputList output_values: Output object of SparseSplit class object.
  • OutputList output_shape: Output object of SparseSplit class object.

Result:

  • std::vector(Tensor) output_indices_result : Returned object of executed result by calling session.
  • std::vector(Tensor) output_values_result : Returned object of executed result by calling session.
  • std::vector(Tensor) output_shape_result : Returned object of executed result by calling session.

Using Method