تدفق التوتر:: العمليات:: مسافة التحرير
#include <array_ops.h>
يحسب (ربما تطبيع) مسافة التحرير Levenshtein.
ملخص
المدخلات عبارة عن تسلسلات متغيرة الطول مقدمة من SparseTensors (مؤشرات الفرضية، وقيم الفرضية، وشكل الفرضية) و(مؤشرات الحقيقة، وقيم_الحقيقة، وشكل_الحقيقة).
المدخلات هي:
الحجج:
- النطاق: كائن النطاق
- فرضية_مؤشرات: مؤشرات قائمة الفرضيات SparseTensor. هذه مصفوفة N x R int64.
- فرضية_القيم: قيم قائمة الفرضيات SparseTensor. هذا هو متجه بطول N.
- فرضية_الشكل: شكل قائمة الفرضيات SparseTensor. هذا متجه ذو طول R.
- Truth_indices: مؤشرات قائمة الحقيقة SparseTensor. هذه مصفوفة M x R int64.
- Truth_values: قيم قائمة الحقيقة SparseTensor. هذا متجه بطول M.
- Truth_shape: مؤشرات الحقيقة، المتجه.
السمات الاختيارية (انظر 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) |
الوظائف العامة | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
الهياكل | |
---|---|
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 )