tensorflow::ops::EditDistance
#include <array_ops.h>Вычисляет (возможно, нормализованное) расстояние редактирования Левенштейна.
Краткое содержание
Входными данными являются последовательности переменной длины, предоставляемые SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) и (truth_indices, truth_values, truth_shape).
Входные данные:
Аргументы:
- scope: Объект Scope
- hypothesis_indices: Индексы списка гипотез SparseTensor. Это матрица int64 размером N x R.
- hypothesis_values: Значения списка гипотез SparseTensor. Это вектор длиной N.
- hypothesis_shape: Форма списка гипотез SparseTensor. Это вектор R-длины.
- truth_indices: Индексы списка истинных значений SparseTensor. Это матрица int64 размером M x R.
- truth_values: Значения разреженного тензора списка истин. Это вектор длиной M.
- truth_shape: индексы истинности, вектор.
Дополнительные атрибуты (см. Attrs ):
- normalize: логическое значение (если true, расстояния редактирования нормализуются по длине истинного значения).
Результат выполнения:
Возвращает:
-
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::Input
operator::tensorflow::Input() const
оператор::tensorflow::Output
operator::tensorflow::Output() const
Открытые статические функции
Нормализация
Attrs Normalize( bool x )