ComputeAccidentalHits


tensorflow C++ API

tensorflow::ops::ComputeAccidentalHits

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 (seeAttrs):

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

ComputeAccidentalHits block

Source link : https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_candidate_sampling_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • Input true_classes: The true_classes output of UnpackSparseLabels.
  • Int64 sampled_candidates: The sampled_candidates output of CandidateSampler.
  • Int64 num_true: Number of true labels per context.
  • ComputeAccidentalHits::Attrs 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.

Return:

  • Output indices: Output object of ComputeAccidentalHits class object.
  • Output ids: Output object of ComputeAccidentalHits class object.
  • Output weights: Output object of ComputeAccidentalHits class object.

Result:

  • std::vector(Tensor) result_indices: A vector of indices corresponding to rows of true_candidates.
  • std::vector(Tensor) result_ids: A vector of IDs of positions in sampled_candidates that match a true_label for the row with the corresponding index in indices.
  • std::vector(Tensor) result_weights: A vector of the same length as indices and ids, in which each element is -FLOAT_MAX.

Using Method

results matching ""

    No results matching ""