fluxo tensor:: ops:: Editar Distância

#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óteses_indices, hipóteses_valores, hipótese_forma) e (verdade_indices, valores_verdade, forma_verdade).

As entradas são:

Argumentos:

  • escopo: um objeto Escopo
  • hipótese_indices: Os índices da lista de hipóteses SparseTensor. Esta é uma matriz N x R int64.
  • hypothese_values: Os valores da lista de hipóteses SparseTensor. Este é um vetor de comprimento N.
  • hypothese_shape: A forma da lista de hipóteses SparseTensor. Este é um vetor de comprimento R.
  • Truth_indices: Os índices da lista verdade SparseTensor. Esta é uma matriz M x R int64.
  • Truth_values: Os valores da lista verdade SparseTensor. Este é um vetor de comprimento M.
  • Truth_shape: índices de verdade, vetor.

Atributos opcionais (veja Attrs ):

  • normalize: boolean (se verdadeiro, as distâncias de edição são normalizadas pelo comprimento da verdade).

A saída é:

Retorna:

  • Output : Um tensor 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

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)

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

Configuradores de atributos opcionais para EditDistance .

Atributos públicos

Operação

Operation operation

saída

::tensorflow::Output output

Funções públicas

Editar Distância

 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 Distância

 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
)

::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
)