tensorflow:: ops:: EditDistance
#include <array_ops.h>Oblicza (możliwie znormalizowaną) odległość edycyjną Levenshteina.
Streszczenie
Danymi wejściowymi są sekwencje o zmiennej długości dostarczane przez SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) i (truth_indices, truth_values, truth_shape).
Dane wejściowe to:
Argumenty:
- zakres: obiekt zakresu
- hypothesis_indices: Indeksy listy hipotez SparseTensor. Jest to macierz N x R int64.
- hipoteza_wartości: Wartości listy hipotez SparseTensor. Jest to wektor o długości N.
- suspect_shape: Kształt listy hipotez SparseTensor. Jest to wektor o długości R.
- truth_indices: Indeksy listy prawdy SparseTensor. Jest to macierz int64 M x R.
- truth_values: Wartości listy prawdy SparseTensor. Jest to wektor o długości M.
- truth_shape: indeksy prawdy, wektor.
Atrybuty opcjonalne (patrz Attrs ):
- normalizuj: wartość logiczna (jeśli prawda, odległości edycyjne są normalizowane według długości prawdy).
Wynik jest następujący:
Zwroty:
-
Output: Gęsty tensor zmiennoprzecinkowy o randze R - 1.
Przykładowe dane wejściowe:
// 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
Wynik będzie następujący:
// 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
Konstruktory i destruktory | |
|---|---|
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) |
Atrybuty publiczne | |
|---|---|
operation | |
output | |
Funkcje publiczne | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Publiczne funkcje statyczne | |
|---|---|
Normalize (bool x) | |
Struktury | |
|---|---|
| tensorflow:: ops:: EditDistance:: Attrs | Opcjonalne settery atrybutów dla EditDistance . |
Atrybuty publiczne
działanie
Operation operation
wyjście
::tensorflow::Output output
Funkcje publiczne
Edytuj odległ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 )
Edytuj odległ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 )
węzeł
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Publiczne funkcje statyczne
Normalizować
Attrs Normalize( bool x )