tensorflow :: opérations :: Modifier la distance
#include <array_ops.h>
Calcule la distance d'édition Levenshtein (éventuellement normalisée).
Résumé
Les entrées sont des séquences de longueur variable fournies par SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) et (vérité_indices, vérité_values, vérité_shape).
Les entrées sont:
Arguments:
- scope: un objet Scope
- hypothesis_indices: Les indices de la liste d'hypothèses SparseTensor. Il s'agit d'une matrice N x R int64.
- hypothesis_values: les valeurs de la liste d'hypothèses SparseTensor. Il s'agit d'un vecteur de longueur N.
- hypothesis_shape: La forme de la liste d'hypothèses SparseTensor. Il s'agit d'un vecteur de longueur R.
- vérité_indices: Les indices de la liste de vérité SparseTensor. Il s'agit d'une matrice M x R int64.
- vérité_values: les valeurs de la liste de vérité SparseTensor. Il s'agit d'un vecteur de longueur M.
- vérité_shape: indices de vérité, vecteur.
Attributs facultatifs (voir Attrs
):
- normaliser: booléen (si vrai, les distances d'édition sont normalisées par longueur de vérité)
La sortie est:
Retour:
-
Output
: un tenseur flottant dense de rang R - 1.
Pour l'exemple d'entrée:
// 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
La sortie sera:
// 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
Constructeurs et destructeurs | |
---|---|
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) |
Attributs publics | |
---|---|
operation | |
output |
Fonctions publiques | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Fonctions statiques publiques | |
---|---|
Normalize (bool x) |
Structs | |
---|---|
tensorflow :: ops :: EditDistance :: Attrs | Définisseurs d' attributs facultatifs pour EditDistance . |
Attributs publics
opération
Operation operation
production
::tensorflow::Output output
Fonctions publiques
Modifier la distance
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 )
Modifier la distance
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 )
nœud
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const
Fonctions statiques publiques
Normaliser
Attrs Normalize( bool x )