ComputeAccidentalHits

public final class ComputeAccidentalHits

Computes the ids of the positions in sampled_candidates that match true_labels.

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.

Nested Classes

class ComputeAccidentalHits.Options Optional attributes for ComputeAccidentalHits  

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

static ComputeAccidentalHits
create(Scope scope, Operand<TInt64> trueClasses, Operand<TInt64> sampledCandidates, Long numTrue, Options... options)
Factory method to create a class wrapping a new ComputeAccidentalHits operation.
Output<TInt64>
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<TInt32>
indices()
A vector of indices corresponding to rows of true_candidates.
static ComputeAccidentalHits.Options
seed(Long seed)
static ComputeAccidentalHits.Options
seed2(Long seed2)
Output<TFloat32>
weights()
A vector of the same length as indices and ids, in which each element is -FLOAT_MAX.

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "ComputeAccidentalHits"

Public Methods

public static ComputeAccidentalHits create (Scope scope, Operand<TInt64> trueClasses, Operand<TInt64> sampledCandidates, Long numTrue, Options... options)

Factory method to create a class wrapping a new ComputeAccidentalHits operation.

Parameters
scope current scope
trueClasses The true_classes output of UnpackSparseLabels.
sampledCandidates The sampled_candidates output of CandidateSampler.
numTrue Number of true labels per context.
options carries optional attributes values
Returns
  • a new instance of ComputeAccidentalHits

public Output<TInt64> ids ()

A vector of IDs of positions in sampled_candidates that match a true_label for the row with the corresponding index in indices.

public Output<TInt32> indices ()

A vector of indices corresponding to rows of true_candidates.

public static ComputeAccidentalHits.Options seed (Long seed)

Parameters
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.

public static ComputeAccidentalHits.Options seed2 (Long seed2)

Parameters
seed2 An second seed to avoid seed collision.

public Output<TFloat32> weights ()

A vector of the same length as indices and ids, in which each element is -FLOAT_MAX.