Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::
ops::
StringSplitV2
#include <string_ops.h>
Split elements of
source
based on
sep
into a
SparseTensor
.
Summary
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:
-
scope: A
Scope
object
-
input:
1-D
string
Tensor
, the strings to split.
-
sep:
0-D
string
Tensor
, the delimiter character.
Optional attributes (see
Attrs
):
-
maxsplit: An
int
. If
maxsplit > 0
, limit of the split of the result.
Returns:
Public static functions
|
Maxsplit
(int64 x)
|
|
Public attributes
Public functions
Public static functions
Maxsplit
Attrs Maxsplit(
int64 x
)
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 2021-05-14 UTC.
[null,null,["Last updated 2021-05-14 UTC."],[],[],null,["# tensorflow::ops::StringSplitV2 Class Reference\n\ntensorflow::\nops::\nStringSplitV2\n================================\n\n`\n#include \u003cstring_ops.h\u003e\n`\n\n\nSplit elements of\n`\nsource\n`\nbased on\n`\nsep\n`\ninto a\n`\nSparseTensor\n`\n.\n\nSummary\n-------\n\n\nLet N be the size of source (typically N will be the batch size). Split each element of\n`\nsource\n`\nbased on\n`\nsep\n`\nand return a\n`\nSparseTensor\n`\ncontaining the split tokens.\n[Empty](/versions/r2.5/api_docs/cc/class/tensorflow/ops/empty#classtensorflow_1_1ops_1_1_empty)\ntokens are ignored.\n\n\nFor example, N = 2, source\\[0\\] is 'hello world' and source\\[1\\] is 'a b c', then the output will be \n\n```text\nst.indices = [0, 0;\n 0, 1;\n 1, 0;\n 1, 1;\n 1, 2]\nst.shape = [2, 3]\nst.values = ['hello', 'world', 'a', 'b', 'c']\n```\n\n\u003cbr /\u003e\n\n\nIf\n`\nsep\n`\nis given, consecutive delimiters are not grouped together and are deemed to delimit empty strings. For example, source of\n`\n\"1\\\u003c\\\u003e2\\\u003c\\\u003e\\\u003c\\\u003e3\"\n`\nand sep of\n`\n\"\\\u003c\\\u003e\"\n`\nreturns\n`\n[\"1\", \"2\", \"\", \"3\"]\n`\n. If\n`\nsep\n`\nis 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.\n\n\nNote that the above mentioned behavior matches python's str.split.\n\n\nArgs:\n\n- scope: A [Scope](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: `\n 1-D\n ` string `\n `[Tensor](/versions/r2.5/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor)`\n ` , the strings to split.\n- sep: `\n 0-D\n ` string `\n `[Tensor](/versions/r2.5/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor)`\n ` , the delimiter character.\n\n\u003cbr /\u003e\n\n\nOptional attributes (see\n`\n`[Attrs](/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-split-v2/attrs#structtensorflow_1_1ops_1_1_string_split_v2_1_1_attrs)`\n`\n):\n\n- maxsplit: An `\n int\n ` . If `\n maxsplit \u003e 0\n ` , limit of the split of the result.\n\n\u003cbr /\u003e\n\n\nReturns:\n\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` indices\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` values\n- `\n `[Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` shape\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| ` `[StringSplitV2](#classtensorflow_1_1ops_1_1_string_split_v2_1acbea51cb12f95ef6cae1972ae134e7ac)` (const :: `[tensorflow::Scope](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` sep) ` ||\n| ` `[StringSplitV2](#classtensorflow_1_1ops_1_1_string_split_v2_1a63b63775de3ac1b5830b860233d56cbc)` (const :: `[tensorflow::Scope](/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, :: `[tensorflow::Input](/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` sep, const `[StringSplitV2::Attrs](/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-split-v2/attrs#structtensorflow_1_1ops_1_1_string_split_v2_1_1_attrs)` & attrs) ` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| ` `[indices](#classtensorflow_1_1ops_1_1_string_split_v2_1afd84236fdcaab70d550ed4c31069c70b)` ` | ` :: `[tensorflow::Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n| ` `[operation](#classtensorflow_1_1ops_1_1_string_split_v2_1a58af1d625de74aabfd6fbf24fc8f5000)` ` | ` `[Operation](/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)` ` |\n| ` `[shape](#classtensorflow_1_1ops_1_1_string_split_v2_1af40d55ff0d2df1679c54c1d41e13dccf)` ` | ` :: `[tensorflow::Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n| ` `[values](#classtensorflow_1_1ops_1_1_string_split_v2_1a06c7c35d77269fee3efbc2f4a6987c30)` ` | ` :: `[tensorflow::Output](/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[Maxsplit](#classtensorflow_1_1ops_1_1_string_split_v2_1a33e93526de570b25c067a8a35545e5b2)` (int64 x) ` | ` `[Attrs](/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-split-v2/attrs#structtensorflow_1_1ops_1_1_string_split_v2_1_1_attrs)` ` |\n\n| ### Structs ||\n|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow:: ops:: StringSplitV2:: Attrs](/versions/r2.5/api_docs/cc/struct/tensorflow/ops/string-split-v2/attrs) | Optional attribute setters for [StringSplitV2](/versions/r2.5/api_docs/cc/class/tensorflow/ops/string-split-v2#classtensorflow_1_1ops_1_1_string_split_v2) . |\n\nPublic attributes\n-----------------\n\n### indices\n\n```text\n::tensorflow::Output indices\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\n### shape\n\n```text\n::tensorflow::Output shape\n``` \n\n### values\n\n```text\n::tensorflow::Output values\n``` \n\nPublic functions\n----------------\n\n### StringSplitV2\n\n```gdscript\n StringSplitV2(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input sep\n)\n``` \n\n### StringSplitV2\n\n```gdscript\n StringSplitV2(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input sep,\n const StringSplitV2::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### Maxsplit\n\n```text\nAttrs Maxsplit(\n int64 x\n)\n```"]]