Skip to content

Commit

Permalink
fix conversion of sequential model using Keras 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed Jan 29, 2018
1 parent 3332717 commit 7bd2f98
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions keras_export/convert_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,18 @@ def convert_sequential_to_model(model):
"""Convert a sequential model to the underlying functional format"""
if type(model).__name__ == 'Sequential':
name = model.name
inbound_nodes = model.inbound_nodes
if hasattr(model, '_inbound_nodes'):
inbound_nodes = model._inbound_nodes
elif hasattr(model, 'inbound_nodes'):
inbound_nodes = model.inbound_nodes
else:
assert False
model = model.model
model.name = name
model.inbound_nodes = inbound_nodes
if hasattr(model, '_inbound_nodes'):
model._inbound_nodes = inbound_nodes
elif hasattr(model, 'inbound_nodes'):
model.inbound_nodes = inbound_nodes
assert model.input_layers
assert model.layers
for i in range(len(model.layers)):
Expand Down

0 comments on commit 7bd2f98

Please sign in to comment.