我正在学习 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 …Run Code Online (Sandbox Code Playgroud)