tensoreflusso:: ops:: ModificaDistanza

#include <array_ops.h>

Calcola la distanza di modifica Levenshtein (eventualmente normalizzata).

Riepilogo

Gli input sono sequenze di lunghezza variabile fornite da SparseTensor (hypothesis_indices, Hypothesis_values, Hypothesis_Shape) e (truth_indices, Truth_values, Truth_Shape).

Gli input sono:

Argomenti:

  • scope: un oggetto Scope
  • ipotesi_indices: gli indici dell'elenco di ipotesi SparseTensor. Questa è una matrice N x R int64.
  • valori_ipotesi: i valori dell'elenco delle ipotesi SparseTensor. Questo è un vettore di lunghezza N.
  • forma_ipotesi: la forma della lista di ipotesi SparseTensor. Questo è un vettore di lunghezza R.
  • Truth_indices: gli indici della lista di verità SparseTensor. Questa è una matrice M x R int64.
  • Truth_values: i valori della lista di verità SparseTensor. Questo è un vettore di lunghezza M.
  • Truth_Shape: indici di verità, vettore.

Attributi facoltativi (vedi Attrs ):

  • normalize: booleano (se vero, le distanze di modifica sono normalizzate in base alla lunghezza vera).

L'output è:

Ritorna:

  • Output : un tensore float denso con rango R - 1.

Per l'esempio input:

// 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

L'output sarà:

// 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  

Costruttori e distruttori

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)

Attributi pubblici

operation
output

Funzioni pubbliche

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

Funzioni pubbliche statiche

Normalize (bool x)

Strutture

tensorflow:: ops:: EditDistance:: Attrs

Setter di attributi facoltativi per EditDistance .

Attributi pubblici

operazione

Operation operation

produzione

::tensorflow::Output output

Funzioni pubbliche

ModificaDistanza

 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
)

ModificaDistanza

 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 

operatore::tensorflow::Input

 operator::tensorflow::Input() const 

operatore::tensorflow::Output

 operator::tensorflow::Output() const 

Funzioni pubbliche statiche

Normalizzare

Attrs Normalize(
  bool x
)