# tfr.keras.losses.LabelDiffLambdaWeight

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/losses.py#L112-L120) |

Keras serializable class for LabelDiffLambdaWeight.

    tfr.keras.losses.LabelDiffLambdaWeight(
        **kwargs
    )

## Methods

### `get_config`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/losses.py#L119-L120)

    get_config() -> Dict[str, Any]

### `individual_weights`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/losses_impl.py#L195-L207)

    individual_weights(
        labels, ranks
    )

Returns the weight `Tensor` for individual examples.

<br />

<br />

<br />

| Args ||
|---|---|
| `labels` | A dense `Tensor` of labels with shape \[batch_size, list_size\]. |
| `ranks` | A dense `Tensor` of ranks with the same shape as `labels` that are sorted by logits. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A `Tensor` that can weight individual examples. ||

<br />

### `pair_weights`

[View source](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/losses_impl.py#L213-L216)

    pair_weights(
        labels, ranks
    )

Returns the absolute label difference for each pair.