جریان تنسور:: عملیات:: Edit Distance
#include <array_ops.h>
فاصله ویرایش لوونشتاین (احتمالاً نرمال شده) را محاسبه می کند.
خلاصه
ورودیها دنبالههایی با طول متغیر هستند که توسط SparseTensors (شاخصهای_فرضی، مقادیر_فرضیه، شکل_فرضیه) و (شاخص_حقیقت، ارزش_صادق، شکل_حقیقت) ارائه میشوند.
ورودی ها عبارتند از:
استدلال ها:
- scope: یک شی Scope
- hypothesis_indices: شاخص های فهرست فرضیه SparseTensor. این یک ماتریس N x R int64 است.
- hypothesis_values: مقادیر فهرست فرضیه SparseTensor. این بردار طول N است.
- hypothesis_shape: شکل لیست فرضیه SparseTensor. این یک بردار با طول R است.
- true_indices: شاخص های لیست حقیقت SparseTensor. این یک ماتریس M x R int64 است.
- true_values: مقادیر لیست حقیقت SparseTensor. این بردار طول M است.
- true_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) |
توابع عمومی | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
سازه ها | |
---|---|
tensorflow:: ops:: EditDistance:: Attrs | تنظیم کننده های ویژگی اختیاری برای EditDistance . |
صفات عمومی
عملیات
Operation operation
خروجی
::tensorflow::Output output
توابع عمومی
Edit Distance
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
)
Edit Distance
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
)