тензорный поток:: опс:: EditDistance

#include <array_ops.h>

Вычисляет (возможно, нормализованное) расстояние редактирования Левенштейна.

Краткое содержание

Входные данные представляют собой последовательности переменной длины, предоставляемые SparseTensors (hypothesis_indices, гипотеза_значения, гипотеза_форма) и (truth_indices, true_values, true_shape).

Входные данные:

Аргументы:

  • область: объект области .
  • гипотеза_indices: Индексы списка гипотез SparseTensor. Это матрица int64 размера N x R.
  • гипотеза_значения: значения списка гипотез SparseTensor. Это вектор длины N.
  • гипотеза_форма: форма списка гипотез SparseTensor. Это вектор R-длины.
  • true_indices: Индексы списка истинности SparseTensor. Это матрица M x R int64.
  • true_values: значения списка истинности SparseTensor. Это вектор M-длины.
  • true_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)

Публичные атрибуты

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

 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
)

узел

::tensorflow::Node * node() const 

оператор::tensorflow::Input

 operator::tensorflow::Input() const 

оператор::tensorflow::Выход

 operator::tensorflow::Output() const 

Публичные статические функции

Нормализовать

Attrs Normalize(
  bool x
)