tfr.keras.losses.get
Stay organized with collections
Save and categorize content based on your preferences.
Factory method to get a ranking loss class.
tfr.keras.losses.get(
loss: str,
reduction: tf.losses.Reduction = tf.losses.Reduction.AUTO,
lambda_weight: Optional[losses_impl._LambdaWeight] = None,
name: Optional[str] = None,
**kwargs
) -> tf.keras.losses.Loss
Args |
loss
|
(str) An attribute of RankingLossKey , defining which loss object to
return.
|
reduction
|
(enum) An enum of strings indicating the loss reduction type.
See type definition in the tf.compat.v2.losses.Reduction .
|
lambda_weight
|
(losses_impl._LambdaWeight) A lambda object for ranking
metric optimization.
|
name
|
(optional) (str) Name of loss.
|
**kwargs
|
Keyword arguments for the loss object.
|
Returns |
A ranking loss instance. See _RankingLoss signature for more details.
|
Raises |
ValueError
|
If loss_key is unsupported.
|
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 2023-08-18 UTC.
[null,null,["Last updated 2023-08-18 UTC."],[],[],null,["# tfr.keras.losses.get\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/keras/losses.py#L50-L109) |\n\nFactory method to get a ranking loss class. \n\n tfr.keras.losses.get(\n loss: str,\n reduction: tf.losses.Reduction = tf.losses.Reduction.AUTO,\n lambda_weight: Optional[losses_impl._LambdaWeight] = None,\n name: Optional[str] = None,\n **kwargs\n ) -\u003e tf.keras.losses.Loss\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------|\n| `loss` | (str) An attribute of `RankingLossKey`, defining which loss object to return. |\n| `reduction` | (enum) An enum of strings indicating the loss reduction type. See type definition in the `tf.compat.v2.losses.Reduction`. |\n| `lambda_weight` | (losses_impl._LambdaWeight) A lambda object for ranking metric optimization. |\n| `name` | (optional) (str) Name of loss. |\n| `**kwargs` | Keyword arguments for the loss object. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A ranking loss instance. See `_RankingLoss` signature for more details. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|-----------------------------|\n| `ValueError` | If loss_key is unsupported. |\n\n\u003cbr /\u003e"]]