tensorflow:: אופס:: ComputeAccidentalHits
#include <candidate_sampling_ops.h>
מחשב את המזהים של המיקומים ב- sampled_candidates התואמים ל-true_labels.
תַקצִיר
בעת ביצוע לוג-אוד NCE, יש להעביר את התוצאה של ניתוח זה דרך הפעלה SparseToDense, ולאחר מכן להוסיף ללוגיטים של המועמדים שנדגמו. יש לכך השפעה של 'הסרה' של התוויות שנדגמו התואמות את התוויות האמיתיות על ידי כך שהמסווג בטוח שהן תוויות שנדגמו.
טיעונים:
- scope: אובייקט Scope
- true_classes: הפלט true_classes של UnpackSparseLabels.
- sampled_candidates: הפלט sampled_candidates של CandidateSampler.
- num_true: מספר התוויות האמיתיות לכל הקשר.
מאפיינים אופציונליים (ראה Attrs
):
- seed: אם ה-seed או seed2 מוגדרים להיות לא-אפס, מחולל המספרים האקראיים מוזרע על ידי ה-seed הנתון. אחרת, הוא נזרע על ידי זרע אקראי.
- seed2: זרע שני כדי למנוע התנגשות זרע.
החזרות:
- מדדי
Output
: וקטור של מדדים התואם לשורות של מועמדים אמיתיים. - מזהי
Output
: וקטור של מזהים של מיקומים ב- sampled_candidates התואמים תווית_true עבור השורה עם האינדקס המתאים במדדים. - משקלי
Output
: וקטור באורך זהה למדדים ומזהים, שבו כל אלמנט הוא -FLOAT_MAX.
בנאים והורסים | |
---|---|
ComputeAccidentalHits (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, :: tensorflow::Input sampled_candidates, int64 num_true) | |
ComputeAccidentalHits (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, :: tensorflow::Input sampled_candidates, int64 num_true, const ComputeAccidentalHits::Attrs & attrs) |
תכונות ציבוריות | |
---|---|
ids | |
indices | |
operation | |
weights |
פונקציות סטטיות ציבוריות | |
---|---|
Seed (int64 x) | |
Seed2 (int64 x) |
מבנים | |
---|---|
tensorflow:: ops:: ComputeAccidentalHits:: Attrs | קובעי תכונות אופציונליים עבור ComputeAccidentalHits . |
תכונות ציבוריות
id
::tensorflow::Output ids
מדדים
::tensorflow::Output indices
מִבצָע
Operation operation
משקולות
::tensorflow::Output weights
תפקידים ציבוריים
ComputeAccidentalHits
ComputeAccidentalHits( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, ::tensorflow::Input sampled_candidates, int64 num_true )
ComputeAccidentalHits
ComputeAccidentalHits( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, ::tensorflow::Input sampled_candidates, int64 num_true, const ComputeAccidentalHits::Attrs & attrs )
פונקציות סטטיות ציבוריות
זֶרַע
Attrs Seed( int64 x )
זרע 2
Attrs Seed2( int64 x )
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[],null,["# tensorflow::ops::ComputeAccidentalHits Class Reference\n\ntensorflow::ops::ComputeAccidentalHits\n======================================\n\n`#include \u003ccandidate_sampling_ops.h\u003e`\n\nComputes the ids of the positions in sampled_candidates that match true_labels.\n\nSummary\n-------\n\nWhen doing log-odds NCE, the result of this op should be passed through a SparseToDense op, then added to the logits of the sampled candidates. This has the effect of 'removing' the sampled labels that match the true labels by making the classifier sure that they are sampled labels.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- true_classes: The true_classes output of UnpackSparseLabels.\n- sampled_candidates: The sampled_candidates output of CandidateSampler.\n- num_true: Number of true labels per context.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/compute-accidental-hits/attrs#structtensorflow_1_1ops_1_1_compute_accidental_hits_1_1_attrs)):\n\n- seed: If either seed or seed2 are set to be non-zero, the random number generator is seeded by the given seed. Otherwise, it is seeded by a random seed.\n- seed2: An second seed to avoid seed collision.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) indices: A vector of indices corresponding to rows of true_candidates.\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) ids: A vector of IDs of positions in sampled_candidates that match a true_label for the row with the corresponding index in indices.\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) weights: A vector of the same length as indices and ids, in which each element is -FLOAT_MAX.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [ComputeAccidentalHits](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a4bad395ebe64ce16a3a939af5780fba8)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` sampled_candidates, int64 num_true)` ||\n| [ComputeAccidentalHits](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1aab1a8827d014d52e454b58bff11c2bd0)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` sampled_candidates, int64 num_true, const `[ComputeAccidentalHits::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/compute-accidental-hits/attrs#structtensorflow_1_1ops_1_1_compute_accidental_hits_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [ids](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a1358bfad5b628af8856e417933559349) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [indices](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a30b8d0fdb8dea05a48830d9855d59c2f) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a3584a7d9cccec061e9e9e0127ca00682) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [weights](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1ab5df3c291c46b6daab30792e03782778) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Seed](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a21e671a41beda2c875664e18da16dee9)`(int64 x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/compute-accidental-hits/attrs#structtensorflow_1_1ops_1_1_compute_accidental_hits_1_1_attrs) |\n| [Seed2](#classtensorflow_1_1ops_1_1_compute_accidental_hits_1a382ee99a2ad217bea85674c232a253f0)`(int64 x)` | [Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/compute-accidental-hits/attrs#structtensorflow_1_1ops_1_1_compute_accidental_hits_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::ComputeAccidentalHits::Attrs](/versions/r2.1/api_docs/cc/struct/tensorflow/ops/compute-accidental-hits/attrs) | Optional attribute setters for [ComputeAccidentalHits](/versions/r2.1/api_docs/cc/class/tensorflow/ops/compute-accidental-hits#classtensorflow_1_1ops_1_1_compute_accidental_hits). |\n\nPublic attributes\n-----------------\n\n### ids\n\n```text\n::tensorflow::Output ids\n``` \n\n### indices\n\n```text\n::tensorflow::Output indices\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\n### weights\n\n```text\n::tensorflow::Output weights\n``` \n\nPublic functions\n----------------\n\n### ComputeAccidentalHits\n\n```gdscript\n ComputeAccidentalHits(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input true_classes,\n ::tensorflow::Input sampled_candidates,\n int64 num_true\n)\n``` \n\n### ComputeAccidentalHits\n\n```gdscript\n ComputeAccidentalHits(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input true_classes,\n ::tensorflow::Input sampled_candidates,\n int64 num_true,\n const ComputeAccidentalHits::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### Seed\n\n```text\nAttrs Seed(\n int64 x\n)\n``` \n\n### Seed2\n\n```text\nAttrs Seed2(\n int64 x\n)\n```"]]