Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
flux tensoriel : : opérations : : Séparation de chaînes
#include <string_ops.h>
Divisez les éléments d' input
en fonction du delimiter
en un SparseTensor
.
Résumé
Soit N la taille de la source (généralement, N sera la taille du lot). Divisez chaque élément d' input
en fonction du delimiter
et renvoyez un SparseTensor
contenant les jetons divisés. Les jetons vides sont ignorés.
delimiter
peut être vide ou une chaîne de caractères divisés. Si delimiter
est une chaîne vide, chaque élément d' input
est divisé en chaînes de caractères individuelles à un octet, y compris la division des séquences multi-octets UTF-8. Sinon, chaque caractère de delimiter
est un point de partage potentiel.
Par exemple : N = 2, input[0] est 'hello world' et input[1] est 'ab c', alors la sortie sera
indices = [0, 0; 0, 1 ; 1, 0 ; 1, 1 ; 1, 2] forme = [2, 3] valeurs = ['bonjour', 'monde', 'a', 'b', 'c']
Arguments :
- scope : un objet Scope
- entrée : 1-D. Cordes à diviser.
- délimiteur : 0-D. Caractères délimiteurs (octets) ou chaîne vide.
Attributs facultatifs (voir Attrs
) :
- skip_empty : un
bool
. Si True
, ignorez les chaînes vides du résultat.
Retours :
- Indices
Output
: une matrice dense de int64 représentant les indices du tenseur clairsemé. - Valeurs
Output
: un vecteur de chaînes correspondant aux valeurs divisées. - Forme
Output
: un vecteur de longueur 2 de int64 représentant la forme du tenseur clairsemé, où la première valeur est N et la deuxième valeur est le nombre maximum de jetons dans une seule entrée d'entrée.
Fonctions statiques publiques |
---|
SkipEmpty (bool x) | |
Attributs publics
Fonctions publiques
Fonctions statiques publiques
SauterVide
Attrs SkipEmpty(
bool x
)
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 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```"]]