نشكرك على متابعة Google I / O. عرض جميع الجلسات عند الطلب مشاهدة عند الطلب

تينسورفلو :: العمليات :: تحرير المسافة

#include <array_ops.h>

يحسب (ربما تم تطبيعه) Levenshtein تحرير المسافة.

ملخص

المدخلات عبارة عن تسلسلات متغيرة الطول توفرها SparseTensors (الفرضيات ، قيم_الفرضيات ، شكل_الفرضية) و (مؤشرات الحقيقة ، قيم الحقيقة ، شكل الحقيقة)

المدخلات هي:

الحجج:

  • النطاق: كائن النطاق
  • hypothesis_indices: مؤشرات قائمة الفرضية SparseTensor. هذه مصفوفة N x R int64.
  • hypothesis_values: قيم قائمة الفرضية SparseTensor. هذا متجه بطول N.
  • hypothesis_shape: شكل قائمة الفرضيات SparseTensor. هذا متجه بطول R.
  • Truth_indices: مؤشرات قائمة الحقيقة SparseTensor. هذه مصفوفة M x R int64.
  • true_values: قيم قائمة الحقيقة SparseTensor. هذا متجه بطول M.
  • الحقيقة_شكل: مؤشرات الحقيقة ، ناقلات.

السمات الاختيارية (انظر Attrs ):

  • التطبيع: منطقي (إذا كان هذا صحيحًا ، يتم تطبيع المسافات حسب طول الحقيقة).

الخرج هو:

عائدات:

  • 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 :: Output

 operator::tensorflow::Output() const 

وظائف ثابتة عامة

تطبيع

Attrs Normalize(
  bool x
)