tensorflow::ops::EditDistance
#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 (hypothesis_indices, hypothesis_values, hypothesis_shape) e (truth_indices, truth_values, truth_shape).
Os parâmetros de entrada são:
Argumentos:
- escopo: Um objeto de escopo
- hypothesis_indices: Os índices da lista de hipóteses SparseTensor. Trata-se de uma matriz int64 de tamanho N x R.
- hypothesis_values: Os valores da lista de hipóteses SparseTensor. Este é um vetor de comprimento N.
- hypothesis_shape: O formato do tensor esparso da lista de hipóteses. Este é um vetor de comprimento R.
- truth_indices: Os índices da lista verdade SparseTensor. Trata-se de uma matriz int64 de tamanho M x R.
- truth_values: Os valores da lista verdade SparseTensor. Este é um vetor de comprimento M.
- truth_shape: índices de verdade, vetor.
Atributos opcionais (ver Attrs ):
- normalizar: booleano (se verdadeiro, as distâncias de edição são normalizadas pelo comprimento da verdade).
O resultado é:
Devoluções:
-
Output: Um tensor de ponto flutuante 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
O 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
Construtores e Destrutores | |
|---|---|
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 | |
Funções públicas | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Funções estáticas públicas | |
|---|---|
Normalize (bool x) | |
Estruturas | |
|---|---|
| tensorflow:: ops:: EditDistance:: Attrs | Definidores de atributos opcionais para EditDistance . |
Atributos públicos
operação
Operation operation
saída
::tensorflow::Output output
Funções públicas
Distância de edição
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 )
Distância de edição
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 )