tensorflow::ops::EditDistance
#include <array_ops.h>คำนวณระยะทางแก้ไขแบบ Levenshtein (ซึ่งอาจมีการปรับให้เป็นมาตรฐานแล้ว)
สรุป
ข้อมูลที่ป้อนเข้าคือลำดับที่มีความยาวแปรผันได้ ซึ่งได้มาจาก SparseTensors (ดัชนีสมมติฐาน ค่าสมมติฐาน รูปร่างสมมติฐาน) และ (ดัชนีความจริง ค่าความจริง รูปร่างความจริง)
ข้อมูลที่ป้อนเข้ามีดังนี้:
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- hypothesis_indices: ดัชนีของ SparseTensor รายการสมมติฐาน นี่คือเมทริกซ์ int64 ขนาด N x R
- hypothesis_values: ค่าของ SparseTensor ในรายการสมมติฐาน นี่คือเวกเตอร์ที่มีความยาว N
- hypothesis_shape: รูปทรงของ SparseTensor รายการสมมติฐาน นี่คือเวกเตอร์ที่มีความยาว R
- truth_indices: ดัชนีของ SparseTensor รายการความจริง นี่คือเมทริกซ์ int64 ขนาด M x R
- truth_values: ค่าของรายการความจริง SparseTensor นี่คือเวกเตอร์ที่มีความยาว M
- truth_shape: ดัชนีความจริง, เวกเตอร์
คุณลักษณะเสริม (ดูที่ Attrs ):
- normalize: ค่าบูลีน (ถ้าเป็นจริง ระยะทางการแก้ไขจะถูกปรับให้เป็นมาตรฐานตามความยาวของค่าความจริง)
ผลลัพธ์คือ:
การส่งคืนสินค้า:
-
Output: เทนเซอร์แบบ float หนาแน่นที่มีอันดับ 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
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
ทำให้เป็นปกติ
Attrs Normalize( bool x )