tensorflow:: אופס:: UniformCandidateSampler
#include <candidate_sampling_ops.h>
יוצר תוויות לדגימת מועמדים בהתפלגות אחידה.
תַקצִיר
ראה הסברים על דגימת מועמדים ותבניות הנתונים ב-go/candidate-sampling.
עבור כל אצווה, פעולה זו בוחרת קבוצה אחת של תוויות מועמדות שנדגמו.
היתרונות של דגימת מועמדים לכל אצווה הם הפשטות והאפשרות של כפל מטריקס צפוף יעיל. החיסרון הוא שיש לבחור את המועמדים הנדגמים ללא תלות בהקשר ובתוויות האמיתיות.
טיעונים:
- scope: אובייקט Scope
- true_classes: מטריצת batch_size * num_true, שבה כל שורה מכילה את המזהים של num_true target_classes בתווית המקורית המתאימה.
- num_true: מספר התוויות האמיתיות לכל הקשר.
- num_sampled: מספר המועמדים לדגימה אקראית.
- ייחודי: אם ייחודי הוא נכון, אנו דוגמים עם דחייה, כך שכל המועמדים שנדגמו באצווה יהיו ייחודיים. זה דורש קירוב מסוים כדי להעריך את הסתברויות הדגימה שלאחר הדחייה.
- range_max: הדגימה תדגום מספרים שלמים מהמרווח [0, range_max).
מאפיינים אופציונליים (ראה Attrs
):
- seed: אם ה-seed או seed2 מוגדרים כלא-אפס, מחולל המספרים האקראיים מוזרע על ידי ה-seed הנתון. אחרת, הוא נזרע על ידי זרע אקראי.
- seed2: זרע שני כדי למנוע התנגשות זרע.
החזרות:
-
Output
sampled_candidates: וקטור באורך num_sampled, שבו כל אלמנט הוא המזהה של מועמד שנדגם. -
Output
true_expected_count: מטריצת batch_size * num_true, המייצגת את מספר הפעמים שכל מועמד צפוי להתרחש באצווה של מועמדים שנדגמו. אם ייחודי=נכון, אז זו הסתברות. -
Output
sampled_expected_count: וקטור באורך num_sampled, עבור כל מועמד שנדגם המייצג את מספר הפעמים שהמועמד צפוי להתרחש בקבוצה של מועמדים שנדגמו. אם ייחודי=נכון, אז זו הסתברות.
בנאים והורסים | |
---|---|
UniformCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max) | |
UniformCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const UniformCandidateSampler::Attrs & attrs) |
תכונות ציבוריות | |
---|---|
operation | |
sampled_candidates | |
sampled_expected_count | |
true_expected_count |
פונקציות סטטיות ציבוריות | |
---|---|
Seed (int64 x) | |
Seed2 (int64 x) |
מבנים | |
---|---|
tensorflow:: ops:: UniformCandidateSampler:: Attrs | קובעי תכונות אופציונליים עבור UniformCandidateSampler . |
תכונות ציבוריות
מִבצָע
Operation operation
sampled_candidates
::tensorflow::Output sampled_candidates
sampled_expected_count
::tensorflow::Output sampled_expected_count
true_expected_count
::tensorflow::Output true_expected_count
תפקידים ציבוריים
UniformCandidateSampler
UniformCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max )
UniformCandidateSampler
UniformCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const UniformCandidateSampler::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-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# tensorflow::ops::UniformCandidateSampler Class Reference\n\ntensorflow::ops::UniformCandidateSampler\n========================================\n\n`#include \u003ccandidate_sampling_ops.h\u003e`\n\nGenerates labels for candidate sampling with a uniform distribution.\n\nSummary\n-------\n\nSee explanations of candidate sampling and the data formats at go/candidate-sampling.\n\nFor each batch, this op picks a single set of sampled candidate labels.\n\nThe advantages of sampling candidates per-batch are simplicity and the possibility of efficient dense matrix multiplication. The disadvantage is that the sampled candidates must be chosen independently of the context and of the true labels.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- true_classes: A batch_size \\* num_true matrix, in which each row contains the IDs of the num_true target_classes in the corresponding original label.\n- num_true: Number of true labels per context.\n- num_sampled: Number of candidates to randomly sample.\n- unique: If unique is true, we sample with rejection, so that all sampled candidates in a batch are unique. This requires some approximation to estimate the post-rejection sampling probabilities.\n- range_max: The sampler will sample integers from the interval \\[0, range_max).\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/uniform-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_uniform_candidate_sampler_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.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) sampled_candidates: A vector of length num_sampled, in which each element is the ID of a sampled candidate.\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) true_expected_count: A batch_size \\* num_true matrix, representing the number of times each candidate is expected to occur in a batch of sampled candidates. If unique=true, then this is a probability.\n- [Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) sampled_expected_count: A vector of length num_sampled, for each sampled candidate representing the number of times the candidate is expected to occur in a batch of sampled candidates. If unique=true, then this is a probability.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [UniformCandidateSampler](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1ad2bca936da372c0e3b0c1034e58fd615)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max)` ||\n| [UniformCandidateSampler](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1ab2a187f26b0545b64a13998b2f018b97)`(const ::`[tensorflow::Scope](/versions/r2.3/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.3/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const `[UniformCandidateSampler::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/uniform-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_uniform_candidate_sampler_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1af2660b86dea858727b0fd8632a95f9b1) | [Operation](/versions/r2.3/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [sampled_candidates](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1af3d782eae21114420811a2d086119c62) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [sampled_expected_count](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1ad7fee9c79ce2eeda957df1c7391ffa6e) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [true_expected_count](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1ad4f7c5007b8d17da8df140ec7504f27c) | `::`[tensorflow::Output](/versions/r2.3/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Seed](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1adf25acd2bcc151e64950e3f5c8c28cfc)`(int64 x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/uniform-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_uniform_candidate_sampler_1_1_attrs) |\n| [Seed2](#classtensorflow_1_1ops_1_1_uniform_candidate_sampler_1adcfc0127820c98af53712f4080e6f863)`(int64 x)` | [Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/uniform-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_uniform_candidate_sampler_1_1_attrs) |\n\n| ### Structs ||\n|-------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::UniformCandidateSampler::Attrs](/versions/r2.3/api_docs/cc/struct/tensorflow/ops/uniform-candidate-sampler/attrs) | Optional attribute setters for [UniformCandidateSampler](/versions/r2.3/api_docs/cc/class/tensorflow/ops/uniform-candidate-sampler#classtensorflow_1_1ops_1_1_uniform_candidate_sampler). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### sampled_candidates\n\n```scdoc\n::tensorflow::Output sampled_candidates\n``` \n\n### sampled_expected_count\n\n```scdoc\n::tensorflow::Output sampled_expected_count\n``` \n\n### true_expected_count\n\n```scdoc\n::tensorflow::Output true_expected_count\n``` \n\nPublic functions\n----------------\n\n### UniformCandidateSampler\n\n```gdscript\n UniformCandidateSampler(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input true_classes,\n int64 num_true,\n int64 num_sampled,\n bool unique,\n int64 range_max\n)\n``` \n\n### UniformCandidateSampler\n\n```gdscript\n UniformCandidateSampler(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input true_classes,\n int64 num_true,\n int64 num_sampled,\n bool unique,\n int64 range_max,\n const UniformCandidateSampler::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```"]]