flujo tensor:: operaciones:: EditarDistancia
#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 (índices_hipótesis, valores_hipótesis, forma_hipótesis) y (índices_verdad, valores_verdad, forma_verdad).
Las entradas son:
Argumentos:
- alcance: un objeto de alcance
- hipótesis_indices: los índices de la lista de hipótesis SparseTensor. Esta es una matriz N x R int64.
- hipótesis_valores: los valores de la lista de hipótesis SparseTensor. Este es un vector de N longitud.
- hipótesis_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. Esta es una matriz M x R int64.
- Truth_values: los valores de la lista de verdad SparseTensor. Este es un vector de longitud M.
- Truth_shape: í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).
La salida es:
Devoluciones:
-
Output
: un tensor 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
La salida 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) |
Funciones públicas | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
estructuras | |
---|---|
tensorflow:: operaciones:: EditDistance:: Atributos | Configuradores de atributos opcionales para EditDistance . |
Atributos públicos
operación
Operation operation
producción
::tensorflow::Output output
Funciones públicas
Editar distancia
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
)
Editar distancia
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::Entrada
operator::tensorflow::Input() const
operador::tensorflow::Salida
operator::tensorflow::Output() const
Funciones estáticas públicas
Normalizar
Attrs Normalize(
bool x
)