# tf.keras.layers.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/layers/serialization.py#L225-L281) |

Instantiates a layer from a config dictionary.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.keras.layers.deserialize(
        config, custom_objects=None, use_legacy_format=False
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `config` | dict of the form {'class_name': str, 'config': dict} |
| `custom_objects` | dict mapping class names (or function names) of custom (non-Keras) objects to class/functions |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Layer instance (may be Model, Sequential, Network, Layer...) ||

<br />

#### Example:

    # Configuration of Dense(32, activation='relu')
    config = {
      'class_name': 'Dense',
      'config': {
        'activation': 'relu',
        'activity_regularizer': None,
        'bias_constraint': None,
        'bias_initializer': {'class_name': 'Zeros', 'config': {} },
        'bias_regularizer': None,
        'dtype': 'float32',
        'kernel_constraint': None,
        'kernel_initializer': {'class_name': 'GlorotUniform',
                               'config': {'seed': None} },
        'kernel_regularizer': None,
        'name': 'dense',
        'trainable': True,
        'units': 32,
        'use_bias': True
      }
    }
    dense_layer = tf.keras.layers.deserialize(config)