tf.keras.models.model_from_json
Stay organized with collections
Save and categorize content based on your preferences.
Parses a JSON model configuration string and returns a model instance.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
`tf.compat.v1.keras.models.model_from_json`
tf.keras.models.model_from_json(
json_string, custom_objects=None
)
Usage:
model = tf.keras.Sequential([
tf.keras.layers.Dense(5, input_shape=(3,)),
tf.keras.layers.Softmax()])
config = model.to_json()
loaded_model = tf.keras.models.model_from_json(config)
Args |
json_string
|
JSON string encoding a model configuration.
|
custom_objects
|
Optional dictionary mapping names
(strings) to custom classes or functions to be
considered during deserialization.
|
Returns |
A Keras model instance (uncompiled).
|
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 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.keras.models.model_from_json\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/saving/legacy/model_config.py#L100-L125) |\n\nParses a JSON model configuration string and returns a model instance.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n\\`tf.compat.v1.keras.models.model_from_json\\`\n\n\u003cbr /\u003e\n\n tf.keras.models.model_from_json(\n json_string, custom_objects=None\n )\n\n#### Usage:\n\n model = tf.keras.Sequential([\n tf.keras.layers.Dense(5, input_shape=(3,)),\n tf.keras.layers.Softmax()])\n config = model.to_json()\n loaded_model = tf.keras.models.model_from_json(config)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------|---------------------------------------------------------------------------------------------------------------------|\n| `json_string` | JSON string encoding a model configuration. |\n| `custom_objects` | Optional dictionary mapping names (strings) to custom classes or functions to be considered during deserialization. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A Keras model instance (uncompiled). ||\n\n\u003cbr /\u003e"]]