keras

Grapher

Creates a visualization of the model structure using pydot.

grapher = keras.utils.dot_utils.Grapher()
  • Methods:
    • plot(model, to_file): creates a graph visualizing the structure of model and writes it to to_file.
      • Arguments:
        • model: an instance of a Keras model (e.g. Sequential)
        • to_file: the filename to save the visualization png to.

Examples:

from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.utils.dot_utils import Grapher

grapher = Grapher()

model = Sequential()
model.add(Dense(64, 2, init='uniform'))
model.add(Activation('softmax'))
grapher.plot(model, 'model.png')