View source on GitHub |
Serializes a Layer
object into a JSON-compatible representation.
tf.keras.layers.serialize(
layer, use_legacy_format=False
)
Args | |
---|---|
layer
|
The Layer object to serialize.
|
Returns | |
---|---|
A JSON-serializable dict representing the object's config. |
Example:
from pprint import pprint
model = tf.keras.models.Sequential()
model.add(tf.keras.Input(shape=(16,)))
model.add(tf.keras.layers.Dense(32, activation='relu'))
pprint(tf.keras.layers.serialize(model))
# prints the configuration of the model, as a dict.