tensorflow :: ops :: EditDistance
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
#include <array_ops.h>
Calcula a distância de edição de Levenshtein (possivelmente normalizada).
Resumo
As entradas são sequências de comprimento variável fornecidas por SparseTensors (hipótese_indices, hipótese_valores, hipótese_forma) e (verdade_indices, verdade_valores, forma_verdadeira).
As entradas são:
Argumentos:
- escopo: um objeto Scope
- hipótese_indices: Os índices da lista de hipóteses SparseTensor. Esta é uma matriz N x R int64.
- hipotesis_values: os valores da lista de hipóteses SparseTensor. Este é um vetor de comprimento N.
- hipótese_shape: a forma da lista de hipóteses SparseTensor. Este é um vetor de comprimento R.
- true_indices: Os índices da lista de verdade SparseTensor. Esta é uma matriz M x R int64.
- true_values: os valores da lista de verdade SparseTensor. Este é um vetor de comprimento M.
- true_shape: índices de verdade, vetor.
Atributos opcionais (consulte Attrs
):
- normalize: boolean (se verdadeiro, as distâncias de edição são normalizadas pelo comprimento da verdade).
O resultado é:
Retorna:
-
Output
: Um tensor de float denso com classificação R-1.
Para o exemplo de entrada:
// 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
A saída 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
Construtores e Destruidores | |
---|---|
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) |
Funções públicas | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Structs | |
---|---|
tensorflow :: ops :: EditDistance :: Attrs | Configuradores de atributos opcionais para EditDistance . |
Atributos públicos
Operação
Operation operation
resultado
::tensorflow::Output output
Funções públicas
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
)
nó
::tensorflow::Node * node() const
operador :: tensorflow :: Input
operator::tensorflow::Input() const
operador :: tensorflow :: Saída
operator::tensorflow::Output() const
Funções estáticas públicas
Normalizar
Attrs Normalize(
bool x
)