Tensorflow :: ops :: StringSplitV2
#include <string_ops.h>
Teilen Sie Elemente der source
basierend auf sep
in einen SparseTensor
.
Zusammenfassung
N sei die Größe der Quelle (typischerweise ist N die Chargengröße). Teilen Sie jedes Element der source
basierend auf sep
und geben Sie einen SparseTensor
, der die geteilten Token enthält. Leere Token werden ignoriert.
Beispiel: N = 2, Quelle [0] ist 'Hallo Welt' und Quelle [1] ist 'ab c', dann ist die Ausgabe
st.indices = [0, 0; 0, 1; 1, 0; 1, 1; 1, 2] st.shape = [2, 3] st.values = ['hello', 'world', 'a', 'b', 'c']
Wenn sep
angegeben ist, werden aufeinanderfolgende Trennzeichen nicht zusammen gruppiert und begrenzen leere Zeichenfolgen. Beispielsweise gibt die Quelle von "1\<\>2\<\>\<\>3"
und der Sep von "\<\>"
["1", "2", "", "3"]
. Wenn sep
None oder eine leere Zeichenfolge ist, werden aufeinanderfolgende Leerzeichen als einzelnes Trennzeichen betrachtet, und das Ergebnis enthält keine leeren Zeichenfolgen am Startende, wenn die Zeichenfolge führende oder nachfolgende Leerzeichen enthält.
Beachten Sie, dass das oben erwähnte Verhalten mit dem str.split von Python übereinstimmt.
Argumente:
- scope: Ein Scope- Objekt
- Eingabe:
1-D
StringTensor
, die zuTensor
Strings. - sep:
0-D
stringTensor
, das Trennzeichen.
Optionale Attribute (siehe Attrs
):
- maxsplit: Ein
int
. Wennmaxsplit > 0
, begrenzen Sie die Aufteilung des Ergebnisses.
Kehrt zurück:
Konstruktoren und Destruktoren | |
---|---|
StringSplitV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input sep) | |
StringSplitV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input sep, const StringSplitV2::Attrs & attrs) |
Öffentliche Attribute | |
---|---|
indices | |
operation | |
shape | |
values |
Öffentliche statische Funktionen | |
---|---|
Maxsplit (int64 x) |
Strukturen | |
---|---|
tensorflow :: ops :: StringSplitV2 :: Attrs | Optionale Attributsetzer für StringSplitV2 . |
Öffentliche Attribute
Indizes
::tensorflow::Output indices
Operation
Operation operation
gestalten
::tensorflow::Output shape
Werte
::tensorflow::Output values
Öffentliche Funktionen
StringSplitV2
StringSplitV2( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input sep )
StringSplitV2
StringSplitV2( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input sep, const StringSplitV2::Attrs & attrs )
Öffentliche statische Funktionen
Maxsplit
Attrs Maxsplit( int64 x )