tensorflow:: ops:: EditDistance

#include <array_ops.h>

(正規化された可能性のある)レーベンシュタイン編集距離を計算します。

まとめ

入力は、SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) および (truth_indices, truth_values, truth_shape) によって提供される可変長のシーケンスです。

入力項目は以下のとおりです。

議論:

  • スコープ:スコープオブジェクト
  • hypothesis_indices: 仮説リストのインデックス(SparseTensor)。これはN x Rのint64行列です。
  • hypothesis_values: 仮説リストの値を表すスパーステンソル。これはN次元ベクトルです。
  • hypothesis_shape: 仮説リストSparseTensorの形状。これはR次元のベクトルです。
  • truth_indices: 真理値リストSparseTensorのインデックス。これはM x Rのint64行列です。
  • truth_values: 真理値リストSparseTensorの値。これは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 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const 

パブリック静的関数

ノーマライズ

Attrs Normalize(
  bool x
)