Skip to content

Commit

Permalink
keras.models.functional.functional_from_config: Fix loading nested fu…
Browse files Browse the repository at this point in the history
…nctional models
  • Loading branch information
torzdf committed Apr 14, 2024
1 parent b267f93 commit 13c3c91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keras/models/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ def process_layer(layer_data):
def get_tensor(layer_name, node_index, tensor_index):
assert layer_name in created_layers
layer = created_layers[layer_name]
if issubclass(layer.__class__, Functional):
# Functional models start with a pre-existing node
# linking their input to output.
node_index -= 1
layer_output_tensors = layer._inbound_nodes[node_index].output_tensors
return layer_output_tensors[tensor_index]

Expand Down

0 comments on commit 13c3c91

Please sign in to comment.