tensorflow::ops::EditDistance
#include <array_ops.h>Menghitung Jarak Edit Levenshtein (yang mungkin telah dinormalisasi).
Ringkasan
Inputnya adalah urutan dengan panjang variabel yang disediakan oleh SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) dan (truth_indices, truth_values, truth_shape).
Inputnya adalah:
Argumen:
- Cakupan: Objek Cakupan
- hypothesis_indices: Indeks dari daftar hipotesis SparseTensor. Ini adalah matriks int64 berukuran N x R.
- hypothesis_values: Nilai-nilai dari daftar hipotesis SparseTensor. Ini adalah vektor dengan panjang N.
- hypothesis_shape: Bentuk dari daftar hipotesis SparseTensor. Ini adalah vektor dengan panjang R.
- truth_indices: Indeks dari daftar kebenaran SparseTensor. Ini adalah matriks int64 berukuran M x R.
- truth_values: Nilai-nilai dari daftar kebenaran SparseTensor. Ini adalah vektor dengan panjang M.
- truth_shape: indeks kebenaran, vektor.
Atribut opsional (lihat Attrs ):
- normalize: boolean (jika true, jarak edit dinormalisasi berdasarkan panjang nilai sebenarnya).
Hasilnya adalah:
Mengembalikan:
-
Output: Tensor float padat dengan rank R - 1.
Untuk contoh 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
Hasilnya akan berupa:
// 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
Konstruktor dan Destruktor | |
|---|---|
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) |
Atribut publik | |
|---|---|
operation | |
output | |
Fungsi publik | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
Fungsi statis publik | |
|---|---|
Normalize (bool x) | |
Struktur | |
|---|---|
| tensorflow::ops::EditDistance::Attrs | Pengaturan atribut opsional untuk EditDistance . |
Atribut publik
operasi
Operation operation
keluaran
::tensorflow::Output output
Fungsi publik
EditJarak
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 )
EditJarak
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 )
simpul
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Fungsi statis publik
Normalisasi
Attrs Normalize( bool x )