tensoreflusso:: ops:: Sottostr
#include <string_ops.h>
Restituisce sottostringhe dal Tensor
di stringhe.
Riepilogo
Per ogni stringa nell'input Tensor
, crea una sottostringa che inizia dall'indice pos
con una lunghezza totale di len
.
Se len
definisce una sottostringa che si estende oltre la lunghezza della stringa di input, vengono utilizzati quanti più caratteri possibile.
Una pos
negativa indica la distanza all'interno della corda a partire dalla fine.
Se pos
specifica un indice che non rientra nell'intervallo per una qualsiasi delle stringhe di input, viene generato un InvalidArgumentError
.
pos
e len
devono avere la stessa forma, altrimenti viene generato un ValueError
durante la creazione dell'Op.
NOTA : Substr
supporta la trasmissione fino a due dimensioni. Maggiori informazioni sulla trasmissione qui
Esempi
Utilizzando pos
e len
scalari:
input = [b'Hello', b'World']
position = 1
length = 3
output = [b'ell', b'orl']
Utilizzando pos
e len
con la stessa forma input
:
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen']]
position = [[1, 2, 3],
[1, 2, 3],
[1, 2, 3]]
length = [[2, 3, 4],
[4, 3, 2],
[5, 5, 5]]
output = [[b'en', b'eve', b'lve'],
[b'hirt', b'urt', b'te'],
[b'ixtee', b'vente', b'hteen']]
Trasmissione pos
e len
input
:
input = [[b'ten', b'eleven', b'twelve'],
[b'thirteen', b'fourteen', b'fifteen'],
[b'sixteen', b'seventeen', b'eighteen'],
[b'nineteen', b'twenty', b'twentyone']]
position = [1, 2, 3]
length = [1, 2, 3]
output = [[b'e', b'ev', b'lve'],
[b'h', b'ur', b'tee'],
[b'i', b've', b'hte'],
[b'i', b'en', b'nty']]
Trasmissione input
su pos
e len
:
input = b'thirteen'
position = [1, 5, 7]
length = [3, 2, 1]
output = [b'hir', b'ee', b'n']
Argomenti:
- scope: un oggetto Scope
- input: Tensore di stringhe
- pos: scalare che definisce la posizione del primo carattere in ciascuna sottostringa
- len: scalare che definisce il numero di caratteri da includere in ciascuna sottostringa
Attributi facoltativi (vedi Attrs
):
- unità: l'unità utilizzata per creare la sottostringa. Uno tra:
"BYTE"
(per definire la posizione e la lunghezza in byte) o"UTF8_CHAR"
(per i punti di codice Unicode codificati UTF-8). Il valore predefinito è"BYTE"
. I risultati non sono definiti seunit=UTF8_CHAR
e le stringheinput
non contengono UTF-8 strutturalmente valido.
Resi:
Costruttori e distruttori | |
---|---|
Substr (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input pos, :: tensorflow::Input len) | |
Substr (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input pos, :: tensorflow::Input len, const Substr::Attrs & attrs) |
Funzioni pubbliche | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Strutture | |
---|---|
tensorflow:: ops:: Substr:: Attrs | Setter di attributi facoltativi per Substr . |
Attributi pubblici
operazione
Operation operation
produzione
::tensorflow::Output output
Funzioni pubbliche
Sottostr
Substr(
const ::tensorflow::Scope & scope,
::tensorflow::Input input,
::tensorflow::Input pos,
::tensorflow::Input len
)
Sottostr
Substr(
const ::tensorflow::Scope & scope,
::tensorflow::Input input,
::tensorflow::Input pos,
::tensorflow::Input len,
const Substr::Attrs & attrs
)
nodo
::tensorflow::Node * node() const
operatore::tensorflow::Input
operator::tensorflow::Input() const
operatore::tensorflow::Output
operator::tensorflow::Output() const
Funzioni pubbliche statiche
Unità
Attrs Unit(
StringPiece x
)