# tf.keras.utils.deserialize_keras_object

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.7.0/keras/utils/generic_utils.py#L609-L724) |

Turns the serialized form of a Keras object back into an actual object.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.keras.utils.deserialize_keras_object`](https://www.tensorflow.org/api_docs/python/tf/keras/utils/deserialize_keras_object)

<br />

    tf.keras.utils.deserialize_keras_object(
        identifier,
        module_objects=None,
        custom_objects=None,
        printable_module_name='object'
    )

This function is for mid-level library implementers rather than end users.

Importantly, this utility requires you to provide the dict of `module_objects`
to use for looking up the object config; this is not populated by default.
If you need a deserialization utility that has preexisting knowledge of
built-in Keras objects, use e.g. [`keras.layers.deserialize(config)`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/layers/deserialize),
[`keras.metrics.deserialize(config)`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/metrics/deserialize), etc.

Calling `deserialize_keras_object` while underneath the
`SharedObjectLoadingScope` context manager will cause any already-seen shared
objects to be returned as-is rather than creating a new object.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `identifier` | the serialized form of the object. |
| `module_objects` | A dictionary of built-in objects to look the name up in. Generally, `module_objects` is provided by midlevel library implementers. |
| `custom_objects` | A dictionary of custom objects to look the name up in. Generally, `custom_objects` is provided by the end user. |
| `printable_module_name` | A human-readable string representing the type of the object. Printed in case of exception. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The deserialized object. ||

<br />

#### Example:

A mid-level library implementer might want to implement a utility for
retrieving an object from its config, as such:

    def deserialize(config, custom_objects=None):
       return deserialize_keras_object(
         identifier,
         module_objects=globals(),
         custom_objects=custom_objects,
         name="MyObjectType",
       )

This is how e.g. [`keras.layers.deserialize()`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/layers/deserialize) is implemented.