Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
tensoreflusso:: ops:: StringSplit
#include <string_ops.h>
Dividere gli elementi di input
in base al delimiter
in uno SparseTensor
.
Riepilogo
Sia N la dimensione della sorgente (tipicamente N sarà la dimensione del batch). Dividi ogni elemento di input
in base al delimiter
e restituisce uno SparseTensor
contenente i token divisi. I token vuoti vengono ignorati.
delimiter
può essere vuoto o una stringa di caratteri suddivisi. Se delimiter
è una stringa vuota, ogni elemento di input
viene suddiviso in singole stringhe di caratteri a byte singolo, inclusa la suddivisione delle sequenze multibyte UTF-8. Altrimenti ogni carattere di delimiter
è un potenziale punto di divisione.
Ad esempio: N = 2, input[0] è 'ciao mondo' e input[1] è 'ab c', quindi l'output sarà
indici = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] forma = [2, 3] valori = ['ciao', 'mondo', 'a', 'b', 'c']
Argomenti:
- scope: un oggetto Scope
- ingresso: 1-D. Corde da dividere.
- delimitatore: 0-D. Caratteri delimitatori (byte) o stringa vuota.
Attributi facoltativi (vedi Attrs
):
- skip_empty: un
bool
. Se True
, salta le stringhe vuote dal risultato.
Resi:
- Indici
Output
: una matrice densa di int64 che rappresenta gli indici del tensore sparso. - Valori
Output
: un vettore di stringhe corrispondenti ai valori divisi. - Forma
Output
: un vettore di lunghezza 2 di int64 che rappresenta la forma del tensore sparso, dove il primo valore è N e il secondo valore è il numero massimo di token in una singola voce di input.
Funzioni pubbliche statiche |
---|
SkipEmpty (bool x) | |
Attributi pubblici
Funzioni pubbliche
Funzioni pubbliche statiche
SaltaVuoto
Attrs SkipEmpty(
bool x
)
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 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.0/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.0/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.0/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.0/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.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) values: A vector of strings corresponding to the splited values.\n- [Output](/versions/r2.0/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.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.0/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.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` delimiter, const `[StringSplit::Attrs](/versions/r2.0/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.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_string_split_1a9f13bcd1e34600b3a8b14445d59142a2) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [shape](#classtensorflow_1_1ops_1_1_string_split_1a008b2049c8b2b2c39f057bd4162dc3c2) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [values](#classtensorflow_1_1ops_1_1_string_split_1ae71dfe97b78a0999e771725948f9ab04) | `::`[tensorflow::Output](/versions/r2.0/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.0/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.0/api_docs/cc/struct/tensorflow/ops/string-split/attrs) | Optional attribute setters for [StringSplit](/versions/r2.0/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```"]]