Tensorflow :: ops :: EditDistance
#include <array_ops.h>
Berechnet den (möglicherweise normalisierten) Levenshtein-Bearbeitungsabstand.
Zusammenfassung
Die Eingaben sind Sequenzen variabler Länge, die von SparseTensors (Hypothesenindizes, Hypothesenwerte, Hypothesenform) und (Wahrheitsindizes, Wahrheitswerte, Wahrheitsform) bereitgestellt werden.
Die Eingänge sind:
Argumente:
- scope: Ein Scope- Objekt
- hypothesenindizes: Die Indizes der Hypothesenliste SparseTensor. Dies ist eine N x R int64-Matrix.
- hypothesenwerte: Die Werte der Hypothesenliste SparseTensor. Dies ist ein N-Längenvektor.
- hypothese_form: Die Form der Hypothesenliste SparseTensor. Dies ist ein R-Längenvektor.
- true_indices: Die Indizes der Wahrheitsliste SparseTensor. Dies ist eine M x R int64-Matrix.
- true_values: Die Werte der Wahrheitsliste SparseTensor. Dies ist ein M-Längenvektor.
- true_shape: Wahrheitsindizes, Vektor.
Optionale Attribute (siehe Attrs
):
- normalize: boolean (wenn true, werden die Bearbeitungsabstände durch die Länge der Wahrheit normalisiert).
Die Ausgabe ist:
Kehrt zurück:
-
Output
: Ein dichter Float-Tensor mit Rang R - 1.
Für die Beispieleingabe:
// hypothesis represents a 2x1 matrix with variable-length values: // (0,0) = ["a"] // (1,0) = ["b"] hypothesis_indices = [[0, 0, 0], [1, 0, 0]] hypothesis_values = ["a", "b"] hypothesis_shape = [2, 1, 1] // truth represents a 2x2 matrix with variable-length values: // (0,0) = [] // (0,1) = ["a"] // (1,0) = ["b", "c"] // (1,1) = ["a"] truth_indices = [[0, 1, 0], [1, 0, 0], [1, 0, 1], [1, 1, 0]] truth_values = ["a", "b", "c", "a"] truth_shape = [2, 2, 2] normalize = true
Die Ausgabe lautet:
// output is a 2x2 matrix with edit distances normalized by truth lengths. output = [[inf, 1.0], // (0,0): no truth, (0,1): no hypothesis [0.5, 1.0]] // (1,0): addition, (1,1): no hypothesis
Konstruktoren und Destruktoren | |
---|---|
EditDistance (const :: tensorflow::Scope & scope, :: tensorflow::Input hypothesis_indices, :: tensorflow::Input hypothesis_values, :: tensorflow::Input hypothesis_shape, :: tensorflow::Input truth_indices, :: tensorflow::Input truth_values, :: tensorflow::Input truth_shape) | |
EditDistance (const :: tensorflow::Scope & scope, :: tensorflow::Input hypothesis_indices, :: tensorflow::Input hypothesis_values, :: tensorflow::Input hypothesis_shape, :: tensorflow::Input truth_indices, :: tensorflow::Input truth_values, :: tensorflow::Input truth_shape, const EditDistance::Attrs & attrs) |
Öffentliche Attribute | |
---|---|
operation | |
output |
Öffentliche Funktionen | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Öffentliche statische Funktionen | |
---|---|
Normalize (bool x) |
Strukturen | |
---|---|
tensorflow :: ops :: EditDistance :: Attrs | Optionale Attributsetzer für EditDistance . |
Öffentliche Attribute
Operation
Operation operation
Ausgabe
::tensorflow::Output output
Öffentliche Funktionen
EditDistance
EditDistance( const ::tensorflow::Scope & scope, ::tensorflow::Input hypothesis_indices, ::tensorflow::Input hypothesis_values, ::tensorflow::Input hypothesis_shape, ::tensorflow::Input truth_indices, ::tensorflow::Input truth_values, ::tensorflow::Input truth_shape )
EditDistance
EditDistance( const ::tensorflow::Scope & scope, ::tensorflow::Input hypothesis_indices, ::tensorflow::Input hypothesis_values, ::tensorflow::Input hypothesis_shape, ::tensorflow::Input truth_indices, ::tensorflow::Input truth_values, ::tensorflow::Input truth_shape, const EditDistance::Attrs & attrs )
Knoten
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const
Öffentliche statische Funktionen
Normalisieren
Attrs Normalize( bool x )