tensorflow:: אופס:: ערוך מרחק

#include <array_ops.h>

מחשב את מרחק העריכה של Levenshtein (אולי מנורמל).

סיכום

הקלטים הם רצפים באורך משתנה המסופקים על ידי SparseTensors (מדדים_השערה, ערכי_השערה, צורת_השערה) ו-(מדד_אמת, ערכי_אמת, צורת_אמת).

הכניסות הן:

טיעונים:

  • scope: אובייקט Scope
  • hypothesis_indices: המדדים של רשימת ההשערות SparseTensor. זוהי מטריצת N x R int64.
  • hypothesis_values: הערכים של רשימת ההשערות SparseTensor. זהו וקטור באורך N.
  • hypothesis_shape: צורת רשימת ההשערות SparseTensor. זהו וקטור באורך R.
  • truth_indices: המדדים של רשימת האמת SparseTensor. זוהי מטריצת M x R int64.
  • truth_values: הערכים של רשימת האמת SparseTensor. זהו וקטור באורך M.
  • truth_shape: מדדי אמת, וקטור.

מאפיינים אופציונליים (ראה Attrs ):

  • normalize: boolean (אם נכון, מרחקי העריכה מנורמלים לפי אורך האמת).

הפלט הוא:

החזרות:

  • Output : טנזור צף צפוף עם דרגה R - 1.

עבור הקלט לדוגמה:

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

הפלט יהיה:

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

בנאים והורסים

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)

תכונות ציבוריות

operation
output

תפקידים ציבוריים

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

פונקציות סטטיות ציבוריות

Normalize (bool x)

מבנים

tensorflow:: ops:: EditDistance:: Attrs

קובעי תכונות אופציונליים עבור EditDistance .

תכונות ציבוריות

מבצע

Operation operation

תְפוּקָה

::tensorflow::Output output

תפקידים ציבוריים

ערוך מרחק

 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
)

צוֹמֶת

::tensorflow::Node * node() const 

מפעיל::tensorflow::קלט

 operator::tensorflow::Input() const 

אופרטור::tensorflow::פלט

 operator::tensorflow::Output() const 

פונקציות סטטיות ציבוריות

נרמל

Attrs Normalize(
  bool x
)