Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
tensor akışı:: işlem:: Mesafeyi Düzenle
#include <array_ops.h>
(Muhtemelen normalleştirilmiş) Levenshtein Düzenleme Mesafesini hesaplar.
Özet
Girdiler, SparseTensors (hipotez_indisleri, hipotez_değerleri, hipotez_şekli) ve (doğruluk_indisleri, doğruluk_değerleri, doğruluk_şekli) tarafından sağlanan değişken uzunluklu dizilerdir.
Girişler şunlardır:
Argümanlar:
- kapsam: Bir Kapsam nesnesi
- hipotez_indices: SparseTensor hipotez listesinin endeksleri. Bu bir N x R int64 matrisidir.
- hipotez_değerleri: SparseTensor hipotez listesinin değerleri. Bu N uzunlukta bir vektördür.
- hipotez_shape: SparseTensor hipotez listesinin şekli. Bu bir R-uzunluk vektörüdür.
- Truth_indices: SparseTensor doğruluk listesinin endeksleri. Bu bir M x R int64 matrisidir.
- doğruluk_değerleri: SparseTensor doğruluk listesinin değerleri. Bu M uzunlukta bir vektördür.
- Truth_shape: doğruluk endeksleri, vektör.
İsteğe bağlı özellikler (bkz. Attrs
):
- normalleştirme: boolean (eğer doğruysa, düzenleme mesafeleri gerçeğin uzunluğuna göre normalleştirilir).
Çıktı:
İade:
-
Output
: Derecesi R - 1 olan yoğun bir kayan nokta tensörü.
Örnek giriş için:
// 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
Çıktı şöyle olacaktır:
// 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
Yapıcılar ve Yıkıcılar |
---|
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) |
Genel özellikler
Kamu işlevleri
düğüm
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operatör::tensorflow::Çıktı
operator::tensorflow::Output() const
Genel statik işlevler
Normalleştir
Attrs Normalize(
bool x
)
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::EditDistance Class Reference\n\ntensorflow::ops::EditDistance\n=============================\n\n`#include \u003carray_ops.h\u003e`\n\nComputes the (possibly normalized) Levenshtein Edit Distance.\n\nSummary\n-------\n\nThe inputs are variable-length sequences provided by SparseTensors (hypothesis_indices, hypothesis_values, hypothesis_shape) and (truth_indices, truth_values, truth_shape).\n\nThe inputs are:\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- hypothesis_indices: The indices of the hypothesis list SparseTensor. This is an N x R int64 matrix.\n- hypothesis_values: The values of the hypothesis list SparseTensor. This is an N-length vector.\n- hypothesis_shape: The shape of the hypothesis list SparseTensor. This is an R-length vector.\n- truth_indices: The indices of the truth list SparseTensor. This is an M x R int64 matrix.\n- truth_values: The values of the truth list SparseTensor. This is an M-length vector.\n- truth_shape: truth indices, vector.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/edit-distance/attrs#structtensorflow_1_1ops_1_1_edit_distance_1_1_attrs)):\n\n- normalize: boolean (if true, edit distances are normalized by length of truth).\n\n\u003cbr /\u003e\n\nThe output is:\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): A dense float tensor with rank R - 1.\n\n\u003cbr /\u003e\n\nFor the example input: \n\n```gdscript\n// hypothesis represents a 2x1 matrix with variable-length values:\n// (0,0) = [\"a\"]\n// (1,0) = [\"b\"]\nhypothesis_indices = [[0, 0, 0],\n [1, 0, 0]]\nhypothesis_values = [\"a\", \"b\"]\nhypothesis_shape = [2, 1, 1]\n\n// truth represents a 2x2 matrix with variable-length values:\n// (0,0) = []\n// (0,1) = [\"a\"]\n// (1,0) = [\"b\", \"c\"]\n// (1,1) = [\"a\"]\ntruth_indices = [[0, 1, 0],\n [1, 0, 0],\n [1, 0, 1],\n [1, 1, 0]]\ntruth_values = [\"a\", \"b\", \"c\", \"a\"]\ntruth_shape = [2, 2, 2]\nnormalize = true\n```\n\n\u003cbr /\u003e\n\nThe output will be: \n\n```scilab\n// output is a 2x2 matrix with edit distances normalized by truth lengths.\noutput = [[inf, 1.0], // (0,0): no truth, (0,1): no hypothesis\n [0.5, 1.0]] // (1,0): addition, (1,1): no hypothesis \n```\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [EditDistance](#classtensorflow_1_1ops_1_1_edit_distance_1a98448a482111a3a9542eb10497edfbdf)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_shape)` ||\n| [EditDistance](#classtensorflow_1_1ops_1_1_edit_distance_1a71ebfcdcb0c51272c8a1952352c23386)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` hypothesis_shape, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_values, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` truth_shape, const `[EditDistance::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/edit-distance/attrs#structtensorflow_1_1ops_1_1_edit_distance_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_edit_distance_1ad892f698a1eede4c4a5e8a315e9d49f4) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_edit_distance_1aa1567444ddf9495875bb89e4815572b6) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_edit_distance_1a37f2320123595e25c3b22b85bb73e4de)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_edit_distance_1a0b07c2848a5af99f253674fbe909f3ef)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_edit_distance_1a3dde48ed219986c41f1a0a0409658ae1)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| [Normalize](#classtensorflow_1_1ops_1_1_edit_distance_1ab7877a4f848a5e5f6682247e07a67cbb)`(bool x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/edit-distance/attrs#structtensorflow_1_1ops_1_1_edit_distance_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::EditDistance::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/edit-distance/attrs) | Optional attribute setters for [EditDistance](/versions/r1.15/api_docs/cc/class/tensorflow/ops/edit-distance#classtensorflow_1_1ops_1_1_edit_distance). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### EditDistance\n\n```gdscript\n EditDistance(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input hypothesis_indices,\n ::tensorflow::Input hypothesis_values,\n ::tensorflow::Input hypothesis_shape,\n ::tensorflow::Input truth_indices,\n ::tensorflow::Input truth_values,\n ::tensorflow::Input truth_shape\n)\n``` \n\n### EditDistance\n\n```gdscript\n EditDistance(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input hypothesis_indices,\n ::tensorflow::Input hypothesis_values,\n ::tensorflow::Input hypothesis_shape,\n ::tensorflow::Input truth_indices,\n ::tensorflow::Input truth_values,\n ::tensorflow::Input truth_shape,\n const EditDistance::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Normalize\n\n```text\nAttrs Normalize(\n bool x\n)\n```"]]