Spec-Zone.ru › TensorFlow C++ 2.9

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. Это матрица N x R типа int64.
  • hypothesis_values: Значения списка гипотез SparseTensor. Это вектор длины N.
  • hypothesis_shape: Форма списка гипотез SparseTensor. Это вектор длины R.
  • truth_indices: Индексы списка истинности SparseTensor. Это матрица M x R типа int64.
  • truth_values: Значения списка истинности SparseTensor. Это вектор длины M.
  • truth_shape: индексы истинности, вектор.

Необязательные атрибуты (см. Attrs):

  • normalize: boolean (если true, расстояния редактирования нормализуются по длине истинности).

Результат:

Возвращает:

  • 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
Operation
output
::tensorflow::Output
Общедоступные функции
node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const
Общедоступные статические функции
Normalize(bool x)
Attrs
Структуры
tensorflow::ops::EditDistance::Attrs

Необязательные устанавливатели атрибутов для EditDistance.

Общедоступные атрибуты

operation

Operation operation

output

::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
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

operator::tensorflow::Input() const 

operator::tensorflow::Output

operator::tensorflow::Output() const 

Общедоступные статические функции

Normalize

Attrs Normalize(
  bool x
)

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/cc/class/tensorflow/ops/edit-distance

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API