tensorflow:: ops:: AllCandidateSampler
#include <candidate_sampling_ops.h>学習済みの単語分布に基づいて、候補サンプリング用のラベルを生成します。
まとめ
候補サンプリングとデータ形式の説明については、go/candidate-sampling を参照してください。
この操作は、各バッチに対して、サンプリングされた候補ラベルのセットを1つ選択します。
バッチごとに候補をサンプリングする利点は、シンプルさと効率的な密行列乗算が可能であることである。欠点は、サンプリングされた候補をコンテキストや真のラベルとは無関係に選択する必要があることである。
議論:
- スコープ:スコープオブジェクト
- true_classes: batch_size * num_true の行列。各行には、対応する元のラベル内の num_true 個の target_classes の ID が含まれます。
- num_true: コンテキストごとの真のラベルの数。
- num_sampled: 生成する候補の数。
- unique: uniqueが真の場合、棄却サンプリングを行い、バッチ内のサンプリングされた候補はすべて一意になるようにします。これには、棄却後のサンプリング確率を推定するための近似計算が必要です。
オプション属性( Attrs参照):
- seed: seedまたはseed2のいずれかがゼロ以外の値に設定されている場合、乱数生成器は指定されたシード値で初期化されます。それ以外の場合は、ランダムなシード値で初期化されます。
- seed2: シードの衝突を避けるための2つ目のシード。
返品:
-
Outputsampled_candidates: 長さ num_sampled のベクトル。各要素はサンプリングされた候補の ID です。 -
Outputtrue_expected_count: バッチサイズ * num_true の行列。サンプリングされた候補のバッチ内で各候補が出現すると予想される回数を表します。unique=true の場合、これは確率です。 -
Outputsampled_expected_count: 長さ num_sampled のベクトル。サンプリングされた候補ごとに、その候補がサンプリングされた候補のバッチ内で出現すると予想される回数を表します。unique=true の場合、これは確率です。
コンストラクターとデストラクタ | |
|---|---|
AllCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique) | |
AllCandidateSampler (const :: tensorflow::Scope & scope, :: tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, const AllCandidateSampler::Attrs & attrs) |
公開属性 | |
|---|---|
operation | |
sampled_candidates | |
sampled_expected_count | |
true_expected_count | |
パブリック静的関数 | |
|---|---|
Seed (int64 x) | |
Seed2 (int64 x) | |
構造 | |
|---|---|
| tensorflow:: ops:: AllCandidateSampler:: Attrs | AllCandidateSamplerのオプション属性セッター。 |
公開属性
手術
Operation operation
サンプリングされた候補者
::tensorflow::Output sampled_candidates
サンプリングされた期待値
::tensorflow::Output sampled_expected_count
真の期待値
::tensorflow::Output true_expected_count
公的機能
すべての候補者サンプラー
AllCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique )
すべての候補者サンプラー
AllCandidateSampler( const ::tensorflow::Scope & scope, ::tensorflow::Input true_classes, int64 num_true, int64 num_sampled, bool unique, const AllCandidateSampler::Attrs & attrs )
パブリック静的関数
シード
Attrs Seed( int64 x )
シード2
Attrs Seed2( int64 x )