tensorflow::ops::ComputeAccidentalHits
#include <candidate_sampling_ops.h>
Computes the ids of the positions in sampled_candidates that match true_labels.
Summary
When 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.
Arguments:
- scope: A Scope object
- true_classes: The true_classes output of UnpackSparseLabels.
- sampled_candidates: The sampled_candidates output of CandidateSampler.
- num_true: Number of true labels per context.
Optional attributes (see Attrs
):
- 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.
- seed2: An second seed to avoid seed collision.
Returns:
-
Output
indices: A vector of indices corresponding to rows of true_candidates. -
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. -
Output
weights: A vector of the same length as indices and ids, in which each element is -FLOAT_MAX.
Constructors and Destructors | |
---|---|
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) |
Public attributes | |
---|---|
ids | |
indices | |
operation | |
weights |
Public static functions | |
---|---|
Seed(int64 x) | |
Seed2(int64 x) |
Structs | |
---|---|
tensorflow::ops::ComputeAccidentalHits::Attrs | Optional attribute setters for ComputeAccidentalHits. |
Public attributes
ids
::tensorflow::Output ids
indices
::tensorflow::Output indices
operation
Operation operation
weights
::tensorflow::Output weights
Public functions
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 )
Public static functions
Seed
Attrs Seed( int64 x )
Seed2
Attrs Seed2( int64 x )
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/cc/class/tensorflow/ops/compute-accidental-hits