# How do I draw the following Keras model?

I am new to deep learning models, and I am trying to figure out the best way to draw a visual representation of the following model. I found a few tools that allow you to draw a model, but I am confused about what the 'best' way to draw this particular model would be.

Any suggestions or recommendations would be great.

Thanks!

You should Go along with Tensorboard, it looks more professional than the rest and it is easier to understand the model.

May I ask your exact purpose for the visualization? You could check others material with the similar purpose and go along with the general choice! Many would go for draw_convnet or PlotNeuralNet if the final use-case was to publish a blog. It also depends on which libraries and softwares you are using!

• thanks for the response! The visualization is for a presentation. I have never drawn a model like this before, and i'm confused about the layers. I can give TensorBoard a try, can you recommend a tutorial for me to follow? – Pythoner Aug 28 '20 at 16:56
• It's okay to be confused, everyone is at the beginning! Here is the link: tensorflow.org/tensorboard/graphs It was in the link you provided yourself! – Aymuos Aug 29 '20 at 0:09

You can use tf.keras.utils.plot_model. For instance this example given in the tensorflow doc:

import tensorflow as tf

input = tf.keras.Input(shape=(100,), dtype='int32', name='input')
x = tf.keras.layers.Embedding(
output_dim=512, input_dim=10000, input_length=100)(input)
x = tf.keras.layers.LSTM(32)(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
x = tf.keras.layers.Dense(64, activation='relu')(x)
output = tf.keras.layers.Dense(1, activation='sigmoid', name='output')(x)
model = tf.keras.Model(inputs=[input], outputs=[output])
dot_img_file = 'model_1.png'
tf.keras.utils.plot_model(model, to_file=dot_img_file, show_shapes=True)



you get the following:

For this function to work you need to install the dependencies:

• pydot (pip3 install pydot)
• an graphviz (install will depend on your OS) have a look at this link