Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
przepływ tensorowy:: ops:: WTopK
#include <nn_ops.h>
Mówi, czy cele znajdują się w górnych przewidywaniach K
Streszczenie
Daje to w wyniku tablicę bool batch_size
, wpis out[i]
jest true
jeśli predykcja dla klasy docelowej znajduje się wśród k
najlepszych predykcji spośród wszystkich predykcji, na przykład i
. Należy pamiętać, że zachowanie InTopK
różni się od operacji TopK
pod względem obsługi powiązań; jeśli wiele klas ma tę samą wartość przewidywania i leży poza górną granicą k
, wszystkie te klasy są uważane za znajdujące się w górnym k
.
Bardziej formalnie niech
\(predictions_i\) będą przewidywaniami dla wszystkich klas, na przykład i
, \(targets_i\) być klasą docelową, na przykład i
, \(out_i\) być wyjściem na przykład i
,
$$out_i = predictions_{i, targets_i} TopKIncludingTies(predictions_i)$$
Argumenty:
- zakres: Obiekt Scope
- przewidywania:
classes
batch_size
x. - targets: wektor
batch_size
identyfikatorów klas. - k: Liczba najważniejszych elementów, na które należy zwrócić uwagę pod kątem precyzji obliczeń.
Zwroty:
Atrybuty publiczne
Funkcje publiczne
węzeł
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Wyjście
operator::tensorflow::Output() const
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 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```"]]