# tf.keras.losses.deserialize

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/losses.py#L2862-L2887) |

Deserializes a serialized loss class/function instance.

#### View aliases


**Main aliases**

[`tf.losses.deserialize`](https://www.tensorflow.org/api_docs/python/tf/keras/losses/deserialize)
**Compat aliases for migration**

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

\`tf.compat.v1.keras.losses.deserialize\`

<br />

    tf.keras.losses.deserialize(
        name, custom_objects=None, use_legacy_format=False
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `name` | Loss configuration. |
| `custom_objects` | Optional dictionary mapping names (strings) to custom objects (classes and functions) to be considered during deserialization. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A Keras `Loss` instance or a loss function. ||

<br />