tf.keras.layers.deserialize
Instantiates a layer from a config dictionary.
tf.keras.layers.deserialize(
config, custom_objects=None
)
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
|
Returns |
Layer instance (may be Model, Sequential, Network, Layer...)
|
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)
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. Some content is licensed under the numpy license.
Last updated 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[]]