keras.utils.plot_model 没有显示图形

Jai*_*lla 0 python pydot keras tensorflow

我正在学习 Keras 和 TensorFlow,我正在尝试运行一个包含 keras.utils.plot_model 指令的示例代码,但他没有向我展示图形,代码的另一部分工作得很好,但最后,我看不到程序应该显示的图形。我有 2 天的时间试图解决这个问题,但我做不到。这是代码:

import numpy as np    
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers

inputs = keras.Input(shape=(784,))
print(inputs.shape) 
print(inputs.dtype) 

dense = layers.Dense(64, activation="relu")
x = dense(inputs) 
x = layers.Dense(64, activation="relu")(x) 
outputs = layers.Dense(10)(x)

model = keras.Model(inputs=inputs, outputs=outputs, name="mnist_model")
print(model.summary())

keras.utils.plot_model(model, "my_first_model.png")

Run Code Online (Sandbox Code Playgroud)

这是模型结果,没有显示图形:

(None, 784)
<dtype: 'float32'>
2020-06-14 13:24:33.233826: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Model: "mnist_model"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         [(None, 784)]             0
_________________________________________________________________
dense (Dense)                (None, 64)                50240
_________________________________________________________________
dense_1 (Dense)              (None, 64)                4160
_________________________________________________________________
dense_2 (Dense)              (None, 10)                650
=================================================================
Total params: 55,050
Trainable params: 55,050
Non-trainable params: 0
_________________________________________________________________
None
Run Code Online (Sandbox Code Playgroud)

我正在使用这些版本:

- Pydot 1.4.1
- Graphviz 2.38
- TensorFlow 2.0.0
- Python 3.7.0
Run Code Online (Sandbox Code Playgroud)

为什么我看不到图形?

小智 5

它在您的文件夹中保存为 png