# tfrs.layers.loss.RemoveAccidentalHits

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/recommenders/blob/v0.7.7/tensorflow_recommenders/layers/loss.py#L114-L147) |

Zeroes the logits of accidental negatives.

    tfrs.layers.loss.RemoveAccidentalHits(
        trainable=True, name=None, dtype=None, dynamic=False, **kwargs
    )

## Methods

### `call`

[View source](https://github.com/tensorflow/recommenders/blob/v0.7.7/tensorflow_recommenders/layers/loss.py#L117-L147)

    call(
        labels: tf.Tensor, logits: tf.Tensor, candidate_ids: tf.Tensor
    ) -> tf.Tensor

Zeros selected logits.

For each row in the batch, zeros the logits of negative candidates that have
the same id as the positive candidate in that row.

<br />

<br />

<br />

| Args ||
|---|---|
| `labels` | \[batch_size, num_candidates\] one-hot labels tensor. |
| `logits` | \[batch_size, num_candidates\] logits tensor. |
| `candidate_ids` | \[num_candidates\] candidate identifiers tensor |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `logits` | Modified logits. |

<br />