テンソルフロー::作戦::編集距離

#include <array_ops.h>

(おそらく正規化された) レーベンシュタイン編集距離を計算します。

まとめ

入力は、SparseTensor によって提供される可変長シーケンス (仮説インデックス、仮説値、仮説形状) および (真実インデックス、真実値、真実形状) です。

入力は次のとおりです。

引数:

  • スコープ:スコープオブジェクト
  • 仮説_indices: 仮説リスト SparseTensor のインデックス。これは N x R の int64 行列です。
  • 仮説値: 仮説リスト SparseTensor の値。これは長さ N のベクトルです。
  • 仮説_形状: 仮説リスト SparseTensor の形状。これは R 長ベクトルです。
  • true_indices: 真理値リスト SparseTensor のインデックス。これは M x R int64 行列です。
  • true_values: 真理値リスト SparseTensor の値。これは長さ M のベクトルです。
  • true_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::入力

 operator::tensorflow::Input() const 

演算子::tensorflow::出力

 operator::tensorflow::Output() const 

パブリック静的関数

ノーマライズ

Attrs Normalize(
  bool x
)