Halaman ini diterjemahkan oleh Cloud Translation API.
Switch to English

tensorflow :: ops :: EditDistance

#include <array_ops.h>

Menghitung Jarak Edit Levenshtein (mungkin dinormalisasi).

Ringkasan

Inputnya adalah urutan variabel-panjang yang disediakan oleh SparseTensors (indeks_hipotesis, nilai_ipotesis, bentuk_ipotesis) dan (indeks_kebenaran, nilai_kebenaran, bentuk_kebenaran).

Inputnya adalah:

Argumen:

  • scope: Objek Scope
  • hipotesis_indeks: Indeks daftar hipotesis SparseTensor. Ini adalah matriks int64 N x R.
  • hipotesis_values: Nilai daftar hipotesis SparseTensor. Ini adalah vektor panjang N.
  • hipotesis_bentuk: Bentuk daftar hipotesis SparseTensor. Ini adalah vektor panjang-R.
  • truth_indices: Indeks daftar kebenaran SparseTensor. Ini adalah matriks M x R int64.
  • truth_values: Nilai dari daftar kebenaran SparseTensor. Ini adalah vektor panjang M.
  • truth_shape: indeks kebenaran, vektor.

Atribut opsional (lihat Attrs ):

  • menormalkan: boolean (jika benar, jarak edit dinormalisasi dengan panjang kebenaran).

Outputnya adalah:

Pengembalian:

  • Output : Tensor pelampung padat dengan peringkat R - 1.

Untuk input contoh:

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

Outputnya adalah:

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

Pembuat dan Penghancur

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)

Structs

tensorflow :: ops :: EditDistance :: Attrs

Penyetel atribut opsional untuk EditDistance .

Atribut publik

operasi

Operation operation
.dll

keluaran

::tensorflow::Output output

Fungsi publik

EditDistance

 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

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

 operator::tensorflow::Output() const 

Fungsi statis publik

Normalisasi

Attrs Normalize(
  bool x
)