Skip to content

Commit 0be55ca

Browse files
committed
Simplify Functional model config construction
1 parent 5039fd9 commit 0be55ca

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

keras/src/models/functional.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,10 @@ def process_layer(layer_data):
497497
# Extract config used to instantiate Functional model from the config. The
498498
# remaining config will be passed as keyword arguments to the Model
499499
# constructor.
500+
# NOTE: Fields not present in config will be None in functional_config.
500501
functional_config = {}
501-
for key in ["layers", "input_layers", "output_layers"]:
502-
functional_config[key] = config.pop(key)
503-
for key in ["name", "trainable"]:
504-
if key in config:
505-
functional_config[key] = config.pop(key)
506-
else:
507-
functional_config[key] = None
502+
for key in ["layers", "input_layers", "output_layers", "name", "trainable"]:
503+
functional_config[key] = config.pop(key, None)
508504

509505
# First, we create all layers and enqueue nodes to be processed
510506
for layer_data in functional_config["layers"]:

0 commit comments

Comments
 (0)