Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
przepływ tensorowy:: ops:: Rozdzielenie ciągu
#include <string_ops.h>
Podziel elementy input
na podstawie delimiter
na SparseTensor
.
Streszczenie
Niech N będzie rozmiarem źródła (zwykle N będzie rozmiarem partii). Podziel każdy element input
na podstawie delimiter
i zwróć SparseTensor
zawierający podzielone tokeny. Puste tokeny są ignorowane.
delimiter
może być pusty lub może być ciągiem podzielonych znaków. Jeśli delimiter
jest pustym ciągiem, każdy element input
jest dzielony na indywidualne ciągi znaków jednobajtowych, łącznie z dzieleniem sekwencji wielobajtowych UTF-8. W przeciwnym razie każdy znak delimiter
jest potencjalnym punktem podziału.
Na przykład: N = 2, wejście [0] to „witaj świecie”, a wejście [1] to „ab c”, wówczas wyjście będzie
indeksy = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] kształt = [2, 3] wartości = ['cześć', 'świat', 'a', 'b', 'c']
Argumenty:
- zakres: Obiekt Scope
- wejście: 1-D. Struny do podziału.
- ogranicznik: 0-D. Znaki rozdzielające (bajty) lub pusty ciąg.
Opcjonalne atrybuty (patrz Attrs
):
- skip_empty:
bool
. Jeśli True
, pomiń puste ciągi z wyniku.
Zwroty:
- Indeksy
Output
: Gęsta macierz int64 reprezentująca indeksy tensora rzadkiego. - Wartości
Output
: wektor ciągów odpowiadający rozdzielonym wartościom. - Kształt
Output
: wektor int64 o długości 2 reprezentujący kształt tensora rzadkiego, gdzie pierwsza wartość to N, a druga wartość to maksymalna liczba tokenów w pojedynczym wpisie wejściowym.
Publiczne funkcje statyczne |
---|
SkipEmpty (bool x) | |
Atrybuty publiczne
Funkcje publiczne
Publiczne funkcje statyczne
Pomiń Puste
Attrs SkipEmpty(
bool x
)
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[],[],null,["# tensorflow::ops::StringSplit Class Reference\n\ntensorflow::ops::StringSplit\n============================\n\n`#include \u003cstring_ops.h\u003e`\n\nSplit elements of `input` based on `delimiter` into a `SparseTensor`.\n\nSummary\n-------\n\nLet 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](/versions/r2.1/api_docs/cc/class/tensorflow/ops/empty#classtensorflow_1_1ops_1_1_empty) tokens are ignored.\n\n`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.\n\nFor example: N = 2, input\\[0\\] is 'hello world' and input\\[1\\] is 'a b c', then the output will be\n\nindices = \\[0, 0; 0, 1; 1, 0; 1, 1; 1, 2\\] shape = \\[2, 3\\] values = \\['hello', 'world', 'a', 'b', 'c'\\]\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: 1-D. Strings to split.\n- delimiter: 0-D. Delimiter characters (bytes), or empty string.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs)):\n\n- skip_empty: A `bool`. If `True`, skip the empty strings from the result.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) indices: A dense matrix of int64 representing the indices of the sparse tensor.\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) values: A vector of strings corresponding to the splited values.\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_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.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [StringSplit](#classtensorflow_1_1ops_1_1_string_split_1ab3e43561fc94bb0cf1dc324ae780b058)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` delimiter)` ||\n| [StringSplit](#classtensorflow_1_1ops_1_1_string_split_1aa084e3f7532182e407e239142972f206)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` delimiter, const `[StringSplit::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [indices](#classtensorflow_1_1ops_1_1_string_split_1ad78d9029594ea73a2d6f82864344d45d) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_string_split_1a9f13bcd1e34600b3a8b14445d59142a2) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [shape](#classtensorflow_1_1ops_1_1_string_split_1a008b2049c8b2b2c39f057bd4162dc3c2) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [values](#classtensorflow_1_1ops_1_1_string_split_1ae71dfe97b78a0999e771725948f9ab04) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| [SkipEmpty](#classtensorflow_1_1ops_1_1_string_split_1af6097b372cd021e78a46d3f6076c6745)`(bool x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/string-split/attrs#structtensorflow_1_1ops_1_1_string_split_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::StringSplit::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/string-split/attrs) | Optional attribute setters for [StringSplit](/versions/r2.1/api_docs/cc/class/tensorflow/ops/string-split#classtensorflow_1_1ops_1_1_string_split). |\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### StringSplit\n\n```gdscript\n StringSplit(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input delimiter\n)\n``` \n\n### StringSplit\n\n```gdscript\n StringSplit(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input delimiter,\n const StringSplit::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### SkipEmpty\n\n```text\nAttrs SkipEmpty(\n bool x\n)\n```"]]