Yes, I did check this as I initially thought htis was the issue. The ticket is here:
Here is the code that reproduces the problem (this code only breaks in tensorflow).
input = keras.layers.Input(shape=(400,400, 1))
x = AveragePooling2D(pool_size=(2,2))(input)
x = Flatten()(x) # This flatten work fine.
x = keras.layers.RepeatVector(3)(x)
x = Reshape((200, 200, 3))(x)
y = AveragePooling2D(pool_size=(4,4))(input)
y = Flatten()(y) # This flatten works fine.
y = keras.layers.RepeatVector(3)(y)
y = Reshape((100, 100, 3))(y)
vgg1 = keras.applications.vgg16.VGG16(include_top=False)
vgg1.trainable = False # Doesnt work
x = vgg1(x)
vgg2 = keras.applications.vgg16.VGG16(include_top=False)
vgg2.trainable = False # Doesnt work
y = vgg2(y)
yUp = keras.layers.UpSampling2D((2,2))(y)
m = keras.layers.merge([x,yUp], mode='sum')
m = keras.layers.Convolution2D(64,3,3, border_mode='same')(m)
m = keras.layers.Flatten()(m) # This line is the error, replacing it with the next line fixes it.
#m = keras.layers.Reshape((6*6*64,))(m)
m = keras.layers.MaxoutDense(8)(m)
m = keras.layers.Dropout(0.5)(m)
m = keras.layers.MaxoutDense(4)(m)
m = keras.layers.Dropout(0.5)(m)
m = keras.layers.Dense(2, activation='softmax')(m)
model = keras.models.Model(input, m)
return model