Reputation: 51
I´m learning Keras and TensorFlow, I´m trying to run a sample code that has keras.utils.plot_model instruction and he doesn´t show me the graphic, the other part of code work very well, but at the end, I can´t see the graphic that the program should show me. I have 2 days trying to solve this problem but I could not do it. This is the code:
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")
This is the model result, that doesn´t show me the graphic:
(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
I´m using these versions:
- Pydot 1.4.1
- Graphviz 2.38
- TensorFlow 2.0.0
- Python 3.7.0
Why I can´t see the graphic?
Upvotes: 5
Views: 3878
Reputation: 360
It's defaulted to saving the output to model.png. You can change it by setting the to_file parameter.
Upvotes: 0