dòng chảy :: hoạt động :: EditDistance
#include <array_ops.h>
Tính khoảng cách chỉnh sửa Levenshtein (có thể chuẩn hóa).
Tóm lược
Các đầu vào là các chuỗi có độ dài thay đổi được cung cấp bởi SparseTensors (chỉ số giả thuyết, giá trị giả thuyết, loại hình giả thuyết) và (chỉ số sự thật, giá trị sự thật, loại hình chân thực).
Các đầu vào là:
Tranh luận:
- phạm vi: Một đối tượng Phạm vi
- Giả thuyết_indices: Các chỉ số của danh sách giả thuyết SparseTensor. Đây là ma trận N x R int64.
- Giả thuyết_values: Các giá trị của danh sách giả thuyết SparseTensor. Đây là một vectơ độ dài N.
- Theory_shape: Hình dạng của danh sách giả thuyết SparseTensor. Đây là một vectơ độ dài R.
- truth_indices: Các chỉ số của danh sách sự thật SparseTensor. Đây là ma trận M x R int64.
- true_values: Các giá trị của danh sách sự thật SparseTensor. Đây là một vectơ độ dài M.
- true_shape: chỉ số sự thật, vectơ.
Các thuộc tính tùy chọn (xem Phần Attrs
):
- normalize: boolean (nếu đúng, khoảng cách chỉnh sửa được chuẩn hóa theo độ dài của sự thật).
Đầu ra là:
Lợi nhuận:
-
Output
: Một tenxơ nổi dày đặc có hạng R - 1.
Đối với đầu vào ví dụ:
// 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
Đầu ra sẽ là:
// 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
Người xây dựng và Người phá hủy | |
---|---|
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) |
Thuộc tính công cộng | |
---|---|
operation | |
output |
Chức năng công cộng | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Các chức năng tĩnh công khai | |
---|---|
Normalize (bool x) |
Cấu trúc | |
---|---|
tensorflow :: ops :: EditDistance :: Attrs | Bộ thiết lập thuộc tính tùy chọn cho EditDistance . |
Thuộc tính công cộng
hoạt động
Operation operation
đầu ra
::tensorflow::Output output
Chức năng công cộng
EditDistance
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
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 )
nút
::tensorflow::Node * node() const
toán tử :: tensorflow :: Đầu vào
operator::tensorflow::Input() const
toán tử :: tensorflow :: Đầu ra
operator::tensorflow::Output() const
Các chức năng tĩnh công khai
Bình thường hóa
Attrs Normalize( bool x )