I am trying to write a GAN in keras but I am getting this assertion error while running it. After searching I found out the most likely cause of the problem is an old version theano. I updated theano to the latest github development version 0.9.0beta1 but still I am getting the same error.
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.optimizers import SGD
print "Setting up decoder"
D = Sequential()
D.add(Dense(100, input_dim=100, activation='relu'))
D.add(Dropout(0.5))
D.add(Dense(50, activation='relu'))
D.add(Dropout(0.5))
D.add(Dense(1, activation='sigmoid'))
sgd = SGD(lr=0.01, momentum=0.1)
D.compile(loss='binary_crossentropy', optimizer=sgd)
print "Setting up generator"
G = Sequential()
G.add(Dense(1, input_dim=1, activation='relu'))
G.add(Dropout(0.5))
G.add(Dense(50, activation='relu'))
G.add(Dropout(0.5))
G.add(Dense(1, activation='sigmoid'))
sgd = SGD(lr=0.01, momentum=0.1)
G.compile(loss='binary_crossentropy', optimizer=sgd)
print "Setting up combined net"
gen_dec = Sequential()
gen_dec.add(G)
D.trainable=False
gen_dec.add(D)
gen_dec.compile(loss='binary_crossentropy', optimizer=sgd)
gen_dec.summary()
The problem happens in this section gen_dec.add(D)
assert input_shape[-1] and input_shape[-1] == self.input_dim
AssertionError