StringSplit
tensorflow C++ API
Split elements of input
based on delimiter
into a SparseTensor
.
Summary
Let N be the size of source (typically N will be the batch size). Split each element of input
based on delimiter
and return a SparseTensor
containing the splitted tokens. Empty tokens are ignored.
delimiter
can be empty, or a string of split characters. If delimiter
is an empty string, each element of input
is split into individual single-byte character strings, including splitting of UTF-8 multibyte sequences. Otherwise every character of delimiter
is a potential split point.
For example: N = 2, input[0] is ‘hello world’ and input[1] is ‘a b c’, then the output will be
indices = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] shape = [2, 3] values = [‘hello’, ‘world’, ‘a’, ‘b’, ‘c’]
Arguments:
- scope: A Scope object
- input: 1-D. Strings to split.
- delimiter: 0-D. Delimiter characters (bytes), or empty string.
Returns:
Output
indices: A dense matrix of int64 representing the indices of the sparse tensor.Output
values: A vector of strings corresponding to the splited values.Output
shape: a length-2 vector of int64 representing the shape of the sparse tensor, where the first value is N and the second value is the maximum number of tokens in a single input entry.
StringSplit block
Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_string.cpp
Argument:
- Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
- Input input: connect Input node.
- Input delimiter: connect Input node.
Return:
- Output output : Output object of StringSplit class in indices object.
- Output output : Output object of StringSplit class in values object.
- Output output : Output object of StringSplit class in shape object.
Result:
- std::vector(Tensor) product_result : Returned object of executed result by calling session.