tfrs.layers.loss.RemoveAccidentalHits
Stay organized with collections
Save and categorize content based on your preferences.
Zeroes the logits of accidental negatives.
tfrs.layers.loss.RemoveAccidentalHits(
trainable=True, name=None, dtype=None, dynamic=False, **kwargs
)
Methods
call
View source
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.
Args |
labels
|
[batch_size, num_candidates] one-hot labels tensor.
|
logits
|
[batch_size, num_candidates] logits tensor.
|
candidate_ids
|
[num_candidates] candidate identifiers tensor
|
Returns |
logits
|
Modified logits.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfrs.layers.loss.RemoveAccidentalHits\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/recommenders/blob/v0.7.3/tensorflow_recommenders/layers/loss.py#L114-L147) |\n\nZeroes the logits of accidental negatives. \n\n tfrs.layers.loss.RemoveAccidentalHits(\n trainable=True, name=None, dtype=None, dynamic=False, **kwargs\n )\n\nMethods\n-------\n\n### `call`\n\n[View source](https://github.com/tensorflow/recommenders/blob/v0.7.3/tensorflow_recommenders/layers/loss.py#L117-L147) \n\n call(\n labels: tf.Tensor, logits: tf.Tensor, candidate_ids: tf.Tensor\n ) -\u003e tf.Tensor\n\nZeros selected logits.\n\nFor each row in the batch, zeros the logits of negative candidates that have\nthe same id as the positive candidate in that row.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-----------------|-------------------------------------------------------|\n| `labels` | \\[batch_size, num_candidates\\] one-hot labels tensor. |\n| `logits` | \\[batch_size, num_candidates\\] logits tensor. |\n| `candidate_ids` | \\[num_candidates\\] candidate identifiers tensor |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|----------|------------------|\n| `logits` | Modified logits. |\n\n\u003cbr /\u003e"]]