tf.raw_ops.StringSplit
Stay organized with collections
Save and categorize content based on your preferences.
Split elements of input
based on delimiter
into a SparseTensor
.
tf.raw_ops.StringSplit(
input, delimiter, skip_empty=True, name=None
)
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']
|
Args |
input
|
A Tensor of type string . 1-D. Strings to split.
|
delimiter
|
A Tensor of type string .
0-D. Delimiter characters (bytes), or empty string.
|
skip_empty
|
An optional bool . Defaults to True .
A bool . If True , skip the empty strings from the result.
|
name
|
A name for the operation (optional).
|
Returns |
A tuple of Tensor objects (indices, values, shape).
|
indices
|
A Tensor of type int64 .
|
values
|
A Tensor of type string .
|
shape
|
A Tensor of type int64 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.StringSplit\n\n\u003cbr /\u003e\n\nSplit elements of `input` based on `delimiter` into a `SparseTensor`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.StringSplit`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/StringSplit)\n\n\u003cbr /\u003e\n\n tf.raw_ops.StringSplit(\n input, delimiter, skip_empty=True, name=None\n )\n\nLet N be the size of source (typically N will be the batch size). Split each\nelement of `input` based on `delimiter` and return a `SparseTensor`\ncontaining the splitted tokens. Empty tokens are ignored.\n\n`delimiter` can be empty, or a string of split characters. If `delimiter` is an\nempty string, each element of `input` is split into individual single-byte\ncharacter strings, including splitting of UTF-8 multibyte sequences. Otherwise\nevery character of `delimiter` is a potential split point.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| For example ----------- ||\n|---|---|\n| N = 2, input\\[0\\] is 'hello world' and input\\[1\\] is 'a b c', then the output will be \u003cbr /\u003e indices = \\[0, 0; 0, 1; 1, 0; 1, 1; 1, 2\\] shape = \\[2, 3\\] values = \\['hello', 'world', 'a', 'b', 'c'\\] ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|------------------------------------------------------------------------------------------------------|\n| `input` | A `Tensor` of type `string`. 1-D. Strings to split. |\n| `delimiter` | A `Tensor` of type `string`. 0-D. Delimiter characters (bytes), or empty string. |\n| `skip_empty` | An optional `bool`. Defaults to `True`. A `bool`. If `True`, skip the empty strings from the result. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----------|------------------------------|\n| A tuple of `Tensor` objects (indices, values, shape). ||\n| `indices` | A `Tensor` of type `int64`. |\n| `values` | A `Tensor` of type `string`. |\n| `shape` | A `Tensor` of type `int64`. |\n\n\u003cbr /\u003e"]]