컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
텐서플로우:: 작전:: 배운UnigramCandidateSampler
#include <candidate_sampling_ops.h>
학습된 유니그램 분포를 사용하여 후보 샘플링에 대한 레이블을 생성합니다.
요약
go/candidate-sampling에서 후보 샘플링 및 데이터 형식에 대한 설명을 확인하세요.
각 배치에 대해 이 작업은 샘플링된 후보 라벨의 단일 세트를 선택합니다.
배치당 후보 샘플링의 장점은 단순성과 효율적인 조밀 행렬 곱셈의 가능성입니다. 단점은 샘플링된 후보를 컨텍스트 및 실제 레이블과 독립적으로 선택해야 한다는 것입니다.
인수:
- 범위: 범위 개체
- true_classes: 각 행에 해당 원본 레이블의 num_true target_classes ID가 포함되어 있는 Batch_size * num_true 행렬.
- num_true: 컨텍스트당 실제 레이블 수입니다.
- num_sampled: 무작위로 샘플링할 후보 수입니다.
- 고유: 고유가 참인 경우 거부를 통해 샘플링하므로 일괄 처리의 샘플링된 모든 후보가 고유합니다. 이를 위해서는 거부 후 샘플링 확률을 추정하기 위한 몇 가지 근사치가 필요합니다.
- range_max: 샘플러는 간격 [0, range_max)의 정수를 샘플링합니다.
선택적 속성( Attrs
참조):
- Seed: Seed 또는 Seed2가 0이 아닌 값으로 설정된 경우 난수 생성기는 지정된 시드에 의해 시드됩니다. 그렇지 않으면 무작위 시드에 의해 시드됩니다.
- Seed2: 시드 충돌을 피하기 위한 두 번째 시드입니다.
보고:
-
Output
samplingd_candidates: 길이가 num_sampled인 벡터. 여기서 각 요소는 샘플링된 후보의 ID입니다. -
Output
true_expected_count: 배치_크기 * num_true 행렬은 샘플링된 후보 배치에서 각 후보가 발생할 것으로 예상되는 횟수를 나타냅니다. Unique=true인 경우 이는 확률입니다. -
Output
samplingd_expected_count: 각 샘플링된 후보에 대해 길이가 num_sampled인 벡터는 샘플링된 후보 배치에서 후보가 발생할 것으로 예상되는 횟수를 나타냅니다. Unique=true인 경우 이는 확률입니다.
생성자와 소멸자 |
---|
LearnedUnigramCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max)
|
LearnedUnigramCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const LearnedUnigramCandidateSampler::Attrs & attrs) |
공개 속성
공공 기능
배운UnigramCandidateSampler
LearnedUnigramCandidateSampler(
const ::tensorflow::Scope & scope,
::tensorflow::Input true_classes,
int64 num_true,
int64 num_sampled,
bool unique,
int64 range_max
)
공개 정적 함수
시드2
Attrs Seed2(
int64 x
)
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[],[],null,["# tensorflow::ops::LearnedUnigramCandidateSampler Class Reference\n\ntensorflow::ops::LearnedUnigramCandidateSampler\n===============================================\n\n`#include \u003ccandidate_sampling_ops.h\u003e`\n\nGenerates labels for candidate sampling with a learned unigram 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.0/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.0/api_docs/cc/struct/tensorflow/ops/learned-unigram-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_learned_unigram_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.0/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.0/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.0/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| [LearnedUnigramCandidateSampler](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a7c50027fcf319a0ac7abcc8af2d8861a)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max)` ||\n| [LearnedUnigramCandidateSampler](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1aaddf15821aae74450fc3b415e18376a9)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` true_classes, int64 num_true, int64 num_sampled, bool unique, int64 range_max, const `[LearnedUnigramCandidateSampler::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/learned-unigram-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a446093e6e23377b91e9335fb0b762ef7) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [sampled_candidates](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a590ac067c5a83a4dba8105564bc56b88) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [sampled_expected_count](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1ab7da3d1ba0800e7229aedb76fafaae7b) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [true_expected_count](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a91c0061329f572532d581b4175a2a8c6) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Seed](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a7993b832d420f9ac8835e0070689ea0d)`(int64 x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/learned-unigram-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1_1_attrs) |\n| [Seed2](#classtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1a043a0a13bbd736a96b60b0a030061638)`(int64 x)` | [Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/learned-unigram-candidate-sampler/attrs#structtensorflow_1_1ops_1_1_learned_unigram_candidate_sampler_1_1_attrs) |\n\n| ### Structs ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::LearnedUnigramCandidateSampler::Attrs](/versions/r2.0/api_docs/cc/struct/tensorflow/ops/learned-unigram-candidate-sampler/attrs) | Optional attribute setters for [LearnedUnigramCandidateSampler](/versions/r2.0/api_docs/cc/class/tensorflow/ops/learned-unigram-candidate-sampler#classtensorflow_1_1ops_1_1_learned_unigram_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### LearnedUnigramCandidateSampler\n\n```gdscript\n LearnedUnigramCandidateSampler(\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### LearnedUnigramCandidateSampler\n\n```gdscript\n LearnedUnigramCandidateSampler(\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 LearnedUnigramCandidateSampler::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```"]]