# tf.raw_ops.ComputeAccidentalHits

<br />

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

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.ComputeAccidentalHits`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/ComputeAccidentalHits)

<br />

    tf.raw_ops.ComputeAccidentalHits(
        true_classes, sampled_candidates, num_true, seed=0, seed2=0, name=None
    )

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.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `true_classes` | A `Tensor` of type `int64`. The true_classes output of UnpackSparseLabels. |
| `sampled_candidates` | A `Tensor` of type `int64`. The sampled_candidates output of CandidateSampler. |
| `num_true` | An `int`. Number of true labels per context. |
| `seed` | An optional `int`. Defaults to `0`. 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 optional `int`. Defaults to `0`. An second seed to avoid seed collision. |
| `name` | A name for the operation (optional). |

<br />

<br />

| ## Returns ||
|---|---|
| A tuple of `Tensor` objects (indices, ids, weights). ||
| `indices` | A `Tensor` of type `int32`. |
| `ids` | A `Tensor` of type `int64`. |
| `weights` | A `Tensor` of type `float32`. |

<br />