tensorflow::ops::EditDistance

#include <array_ops.h>

Calcola la distanza di Levenshtein (eventualmente normalizzata).

Riepilogo

Gli input sono sequenze di lunghezza variabile fornite da SparseTensors (indici_ipotesi, valori_ipotesi, forma_ipotesi) e (indici_verità, valori_verità, forma_verità).

Gli input sono:

Argomentazioni:

  • ambito: un oggetto Scope
  • hypothesis_indices: Gli indici dell'elenco di ipotesi SparseTensor. Si tratta di una matrice N x R int64.
  • hypothesis_values: I valori dell'elenco di ipotesi SparseTensor. Si tratta di un vettore di lunghezza N.
  • hypothesis_shape: La forma dell'elenco di ipotesi SparseTensor. Si tratta di un vettore di lunghezza R.
  • truth_indices: Gli indici della lista di verità SparseTensor. Si tratta di una matrice M x R int64.
  • truth_values: I valori della lista di verità SparseTensor. Si tratta di un vettore di lunghezza M.
  • truth_shape: indici di verità, vettore.

Attributi opzionali (vedere Attrs ):

  • normalizza: booleano (se vero, le distanze di modifica vengono normalizzate in base alla lunghezza della verità).

L'output è:

Resi:

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

Per l'input di esempio:

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

Normalize (bool x)

Strutture

tensorflow::ops::EditDistance::Attrs

Impostatori di attributi opzionali per EditDistance .

attributi pubblici

operazione

Operation operation

produzione

::tensorflow::Output output

Funzioni pubbliche

Distanza di modifica

 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
)

Distanza di modifica

 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::tensoreflusso::output

 operator::tensorflow::Output() const 

Funzioni statiche pubbliche

Normalizzare

Attrs Normalize(
  bool x
)