title: Keras dynamic graphs
body: <p>It is known that Keras is based on static graphs. However, it seems to me that it is not really the case since I can make my graph implementation dynamic.
  Here is a simple example proving my claim:</p>
  
  <pre><code>import keras.backend as K
  import numpy as np
  from keras.models import Model
  from keras.layers import Dense, Input, Dropout
  from keras.losses import mean_squared_error
  
  def get_mnist():
       np.random.seed(1234) # set seed for deterministic ordering
       (x_train, y_train), (x_test, y_test) = mnist.load_data()
       x_all = np.concatenate((x_train, x_test), axis = 0)
       Y = np.concatenate((y_train, y_test), axis = 0)
       X = x_all.reshape(-1,x_all.shape[1]*x_all.shape[2])
       p = np.random.permutation(X.shape[0])
       X = X[p].astype(np.float32)*0.02
       Y = Y[p]
       return X, Y
  
  
  X, Y  = get_mnist()
  drop = K.variable(0.2)
  input = Input(shape=(784,))
  x = Dropout(rate=drop.value)(input)
  x = Dense(128, activation="relu", name="encoder_layer")(x)
  decoder = Dense(784, activation="relu", name="decoder_layer")(x)
  autoencoder = Model(inputs=input, outputs=decoder)
  autoencoder.compile(optimizer='adadelta', loss= mean_squared_error)
  autoencoder.fit(X, X, batch_size=256, epochs=300)
  K.set_value(drop, 0.5)
  autoencoder.fit(X, X, batch_size=256, epochs=300)
  </code></pre>
  
  <p>It is obvious that we can change the value of <code>drop</code> at any time, even after compiling the model. 
  <br/>
  If it is a Static Graph, how should I be able to do so?
  <br/>
  Am I missing the point? 
  <br/>
  In case I do, what is the real interpretation of Dynamic Graphs?</p>