Skip to content

Commit

Permalink
Simplify Functional model config construction
Browse files Browse the repository at this point in the history
  • Loading branch information
TrAyZeN committed Oct 7, 2024
1 parent 5039fd9 commit 0be55ca
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions keras/src/models/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,10 @@ def process_layer(layer_data):
# Extract config used to instantiate Functional model from the config. The
# remaining config will be passed as keyword arguments to the Model
# constructor.
# NOTE: Fields not present in config will be None in functional_config.
functional_config = {}
for key in ["layers", "input_layers", "output_layers"]:
functional_config[key] = config.pop(key)
for key in ["name", "trainable"]:
if key in config:
functional_config[key] = config.pop(key)
else:
functional_config[key] = None
for key in ["layers", "input_layers", "output_layers", "name", "trainable"]:
functional_config[key] = config.pop(key, None)

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

0 comments on commit 0be55ca

Please sign in to comment.