aliran tensor:: operasi:: Sunting Jarak

#include <array_ops.h>

Menghitung Jarak Edit Levenshtein (mungkin dinormalisasi).

Ringkasan

Inputnya adalah urutan panjang variabel yang disediakan oleh SparseTensors (hypothesis_indices, hypothesis_values, hypotesis_shape) dan (truth_indices, truth_values, truth_shape).

Masukannya adalah:

Argumen:

  • ruang lingkup: Objek Lingkup
  • hipotesis_indeks: Indeks daftar hipotesis SparseTensor. Ini adalah matriks N x R int64.
  • nilai_hipotesis: Nilai daftar hipotesis SparseTensor. Ini adalah vektor dengan panjang N.
  • hypotesis_shape : Bentuk daftar hipotesis SparseTensor. Ini adalah vektor dengan panjang R.
  • truth_indices: Indeks daftar kebenaran SparseTensor. Ini adalah matriks M x R int64.
  • truth_values: Nilai daftar kebenaran SparseTensor. Ini adalah vektor dengan panjang M.
  • truth_shape: indeks kebenaran, vektor.

Atribut opsional (lihat Attrs ):

  • normalisasi: boolean (jika benar, jarak edit dinormalisasi berdasarkan panjang kebenaran).

Outputnya adalah:

Pengembalian:

  • Output : Tensor float padat dengan rank R - 1.

Sebagai contoh masukan:

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

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

Penyetel atribut opsional untuk EditDistance .

Atribut publik

operasi

Operation operation

keluaran

::tensorflow::Output output

Fungsi publik

Sunting Jarak

 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
)

Sunting Jarak

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

 operator::tensorflow::Input() const 

operator::tensorflow::Keluaran

 operator::tensorflow::Output() const 

Fungsi statis publik

Normalisasi

Attrs Normalize(
  bool x
)