tensorflow:: ops:: EditDistance
#include <array_ops.h>Calcula la distancia de edición de Levenshtein (posiblemente normalizada).
Resumen
Las entradas son secuencias de longitud variable proporcionadas por SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) y (truth_indices, truth_values, truth_shape).
Las entradas son:
Argumentos:
- ámbito: Un objeto de ámbito
- hypothesis_indices: Los índices de la lista de hipótesis SparseTensor. Se trata de una matriz N x R int64.
- valores_de_hipótesis: Los valores de la lista de hipótesis SparseTensor. Este es un vector de longitud N.
- hypothesis_shape: La forma de la lista de hipótesis SparseTensor. Este es un vector de longitud R.
- truth_indices: Los índices de la lista de verdad SparseTensor. Se trata de una matriz M x R de tipo int64.
- truth_values: Los valores de la lista de verdad SparseTensor. Este es un vector de longitud M.
- forma_de_verdad: índices de verdad, vector.
Atributos opcionales (ver Attrs ):
- normalizar: booleano (si es verdadero, las distancias de edición se normalizan según la longitud de la verdad).
El resultado es:
Devoluciones:
-
Output: Un tensor de punto flotante denso con rango R - 1.
Para la entrada de ejemplo:
// 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
El resultado será:
// 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
Constructores y destructores | |
|---|---|
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) |
Atributos públicos | |
|---|---|
operation | |
output | |
Funciones públicas | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
funciones estáticas públicas | |
|---|---|
Normalize (bool x) | |
Estructuras | |
|---|---|
| tensorflow:: ops:: EditDistance:: Attrs | Configuradores de atributos opcionales para EditDistance . |
Atributos públicos
operación
Operation operation
producción
::tensorflow::Output output
Funciones públicas
EditarDistancia
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 )
EditarDistancia
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 )
nodo
::tensorflow::Node * node() const
operador::tensorflow::Input
operator::tensorflow::Input() const
operador::tensorflow::Salida
operator::tensorflow::Output() const
funciones estáticas públicas
Normalizar
Attrs Normalize( bool x )