我正在尝试在 Keras 中绘制我的模型,如下所示:
# Plot model graph
tf.keras.utils.plot_model(model, to_file='Model1.png')
from IPython.display import Image
Image(retina=True, filename='Model1.png')
我得到以下结果:我的模型
但是,我在互联网上的某个地方看到,有人绘制了他的模型,就像这样:我需要的模型
如何将我的代码更改为这样的绘图?使用模型每一层的输入/输出信息?
您可以使用参数show_shapes=True
。
从tf.keras
文档中:
show_shapes:是否显示形状信息。
(在这里仔细看看:https://www.tensorflow.org/api_docs/python/tf/keras/utils/plot_model(