Qinbf / plot_model

plot model for Tensorflow/Keras
MIT License
36 stars 15 forks source link

Failure with Tensorflow >= 2.3 #1

Open kelsey-sorrels opened 4 years ago

kelsey-sorrels commented 4 years ago

Calling plot_model(...) using tensorflow 2.3 or greater results in the error message

  File "/[redacted]/lib/python3.6/site-packages/plot_model/plot_model.py", line 91, in model_to_dot
    from tensorflow.python.keras.engine import network
ImportError: cannot import name 'network'

The network module is no longer present, see https://github.com/tensorflow/tensorflow/tree/v2.3.1/tensorflow/python/keras/engine

kelsey-sorrels commented 4 years ago

Got this working by replacing network and network.Network with functional and functional.Functional. Breaking change appears to be https://github.com/tensorflow/tensorflow/commit/bb15c97379f197a6a46ec1446d8fb0b292b860ba#diff-7c9eaab01e9c5c241737b86bcdcca7ba6fcac13759cca29c39b1b6231ddc66cd

CometManAtGitHub commented 2 years ago

Hi. Thanks. This works with additional change for Tensorflow-2.5.0 on Windows. layers = model.layers #_layers

in file: plot_model.py line 127