tf.raw_ops.StringSplitV2
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Split elements of source
based on sep
into a SparseTensor
.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.raw_ops.StringSplitV2
tf.raw_ops.StringSplitV2(
input, sep, maxsplit=-1, name=None
)
Let N be the size of source (typically N will be the batch size). Split each
element of source
based on sep
and return a SparseTensor
containing the split tokens. Empty tokens are ignored.
For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c',
then the output will be
st.indices = [0, 0;
0, 1;
1, 0;
1, 1;
1, 2]
st.shape = [2, 3]
st.values = ['hello', 'world', 'a', 'b', 'c']
If sep
is given, consecutive delimiters are not grouped together and are
deemed to delimit empty strings. For example, source of "1<>2<><>3"
and
sep of "<>"
returns ["1", "2", "", "3"]
. If sep
is None or an empty
string, consecutive whitespace are regarded as a single separator, and the
result will contain no empty strings at the startor end if the string has
leading or trailing whitespace.
Note that the above mentioned behavior matches python's str.split.
Args |
input
|
A Tensor of type string .
1-D string Tensor , the strings to split.
|
sep
|
A Tensor of type string .
0-D string Tensor , the delimiter character.
|
maxsplit
|
An optional int . Defaults to -1 .
An int . If maxsplit > 0 , limit of the split of 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.StringSplitV2\n\n\u003cbr /\u003e\n\nSplit elements of `source` based on `sep` 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.StringSplitV2`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/StringSplitV2)\n\n\u003cbr /\u003e\n\n tf.raw_ops.StringSplitV2(\n input, sep, maxsplit=-1, name=None\n )\n\nLet N be the size of source (typically N will be the batch size). Split each\nelement of `source` based on `sep` and return a `SparseTensor`\ncontaining the split tokens. Empty tokens are ignored.\n\nFor example, N = 2, source\\[0\\] is 'hello world' and source\\[1\\] is 'a b c',\nthen the output will be \n\n st.indices = [0, 0;\n 0, 1;\n 1, 0;\n 1, 1;\n 1, 2]\n st.shape = [2, 3]\n st.values = ['hello', 'world', 'a', 'b', 'c']\n\nIf `sep` is given, consecutive delimiters are not grouped together and are\ndeemed to delimit empty strings. For example, source of `\"1\u003c\u003e2\u003c\u003e\u003c\u003e3\"` and\nsep of `\"\u003c\u003e\"` returns `[\"1\", \"2\", \"\", \"3\"]`. If `sep` is None or an empty\nstring, consecutive whitespace are regarded as a single separator, and the\nresult will contain no empty strings at the startor end if the string has\nleading or trailing whitespace.\n\nNote that the above mentioned behavior matches python's str.split.\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` string `Tensor`, the strings to split. |\n| `sep` | A `Tensor` of type `string`. `0-D` string `Tensor`, the delimiter character. |\n| `maxsplit` | An optional `int`. Defaults to `-1`. An `int`. If `maxsplit \u003e 0`, limit of the split of 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"]]