Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
tensoreflusso:: ops:: InTopK
#include <nn_ops.h>
Indica se gli obiettivi rientrano nelle previsioni K
principali.
Riepilogo
Ciò restituisce un array bool batch_size
, una voce out[i]
è true
se la previsione per la classe di destinazione è tra le prime k
previsioni tra tutte le previsioni, ad esempio i
. Si noti che il comportamento di InTopK
differisce dall'operazione TopK
nella gestione dei valori di parità; se più classi hanno lo stesso valore di previsione e si trovano a cavallo del limite top- k
, tutte quelle classi sono considerate nel top k
.
Più formalmente, lasciamo
\(predictions_i\) essere le previsioni per tutte le classi, ad esempio i
, \(targets_i\) essere la classe di destinazione, ad esempio i
, \(out_i\) essere l'output per esempio i
,
$$out_i = predictions_{i, targets_i} TopKIncludingTies(predictions_i)$$
Argomenti:
- scope: un oggetto Scope
- previsioni: un tensore
classes
batch_size
x. - target: un vettore
batch_size
di ID di classe. - k: numero di elementi principali da considerare per la precisione del calcolo.
Resi:
Attributi pubblici
Funzioni pubbliche
nodo
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operatore::tensorflow::Output
operator::tensorflow::Output() const
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::InTopK Class Reference\n\ntensorflow::ops::InTopK\n=======================\n\n`#include \u003cnn_ops.h\u003e`\n\nSays whether the targets are in the top `K` predictions.\n\nSummary\n-------\n\nThis outputs a `batch_size` bool array, an entry `out[i]` is `true` if the prediction for the target class is among the top `k` predictions among all predictions for example `i`. Note that the behavior of [InTopK](/versions/r1.15/api_docs/cc/class/tensorflow/ops/in-top-k#classtensorflow_1_1ops_1_1_in_top_k) differs from the [TopK](/versions/r1.15/api_docs/cc/class/tensorflow/ops/top-k#classtensorflow_1_1ops_1_1_top_k) op in its handling of ties; if multiple classes have the same prediction value and straddle the top-`k` boundary, all of those classes are considered to be in the top `k`.\n\nMore formally, let\n\n\\\\(predictions_i\\\\) be the predictions for all classes for example `i`, \\\\(targets_i\\\\) be the target class for example `i`, \\\\(out_i\\\\) be the output for example `i`,\n\n$$out_i = predictions_{i, targets_i} TopKIncludingTies(predictions_i)$$\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- predictions: A `batch_size` x `classes` tensor.\n- targets: A `batch_size` vector of class ids.\n- k: Number of top elements to look at for computing precision.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Computed Precision at `k` as a `bool `[Tensor](/versions/r1.15/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor).\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [InTopK](#classtensorflow_1_1ops_1_1_in_top_k_1a377574cc533f3b91fea7345442e1998f)`(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)` predictions, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` targets, int64 k)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_in_top_k_1afe7a77dd6f17c474fce97861cab29527) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [precision](#classtensorflow_1_1ops_1_1_in_top_k_1a43116d147476cd8f69ce01d5c3c9f915) | `::`[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_in_top_k_1a135e20737a15b73e8336cea65b60ad87)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_in_top_k_1a0b88d86f83d7e064c8c3189793a3400b)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_in_top_k_1a63713331ec8812a5470f740a7fd9f5df)`() const ` | ` ` ` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### precision\n\n```text\n::tensorflow::Output precision\n``` \n\nPublic functions\n----------------\n\n### InTopK\n\n```gdscript\n InTopK(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input predictions,\n ::tensorflow::Input targets,\n int64 k\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```"]]