Skip to content

Commit

Permalink
Fix conversion from sequential to functional models
Browse files Browse the repository at this point in the history
Reset layer._inbound_nodes before applying the layer to a new input
  • Loading branch information
Dobiasd committed Sep 21, 2019
1 parent c47e5ab commit 1c91a48
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions keras_export/convert_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ def convert_sequential_to_model(model):
input_layer = Input(batch_shape=model.layers[0].input_shape)
prev_layer = input_layer
for layer in model.layers:
layer._inbound_nodes = []
prev_layer = layer(prev_layer)
funcmodel = Model([input_layer], [prev_layer])
model = funcmodel
Expand Down

0 comments on commit 1c91a48

Please sign in to comment.