title: Converting model declaration in Keras (removing Sequential) into a new one without Sequential returns different shape
body: <p>I'm newbie with Python, Tensorflow and Keras.</p>
  
  <p>I have modified this code:</p>
  
  <pre><code>def build_base_network(input_shape):
  
      seq = Sequential()
  
      nb_filter = [6, 12]
      kernel_size = 3
  
  
      #convolutional layer 1
      seq.add(Convolution2D(nb_filter[0], kernel_size, kernel_size, input_shape=input_shape,
                            border_mode='valid', dim_ordering='th'))
      seq.add(Activation('relu'))
      seq.add(MaxPooling2D(pool_size=(2, 2)))  
      seq.add(Dropout(.25))
  
      #convolutional layer 2
      seq.add(Convolution2D(nb_filter[1], kernel_size, kernel_size, border_mode='valid', dim_ordering='th'))
      seq.add(Activation('relu'))
      seq.add(MaxPooling2D(pool_size=(2, 2), dim_ordering='th')) 
      seq.add(Dropout(.25))
  
      #flatten 
      seq.add(Flatten())
      seq.add(Dense(128, activation='relu'))
      seq.add(Dropout(0.1))
      seq.add(Dense(50, activation='relu'))
      return seq
  </code></pre>
  
  <p>Writing my own version:</p>
  
  <pre><code>def build_base_network(input_shape):
  
      inputs = Input(shape = input_shape)
  
      nb_filter = [6, 12]
      kernel_size = 3
      conv1 = Conv2D(nb_filter[0], (kernel_size, kernel_size), activation='relu', padding="valid", data_format='channels_first')(inputs)
      pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)
      drop1 = Dropout(.25)(pool1)
  
      #convolutional layer 2
      conv2 = Conv2D(nb_filter[1], (kernel_size, kernel_size), activation='relu', padding="valid", data_format="channels_first")(drop1)
      pool2 = MaxPooling2D(pool_size=(2, 2), data_format="channels_first")(conv2)
      drop2 = Dropout(.25)(pool2)
  
      #flatten 
      dense1 = Dense(128, activation='relu')(drop2)
      drop3 = Dropout(0.1)(dense1)
      dense2 = Dense(50, activation='relu')(drop3)
  
      model = Model(inputs=inputs, outputs=dense2)
  
      return model
  </code></pre>
  
  <p>I call it with this code:</p>
  
  <pre><code>input_dim = x_train.shape[2:]
  img_a = Input(shape=input_dim)
  img_b = Input(shape=input_dim)
  base_network = build_base_network(input_dim)
  feat_vecs_a = base_network(img_a)
  feat_vecs_b = base_network(img_b)
  </code></pre>
  
  <p>The unmodified code (the first one) returns this shape: <code>(None, 50)</code>
  The modified code (my own version) returns this shape: <code>(None, 12, 12, 50)</code></p>
  
  <p>I hadn't modified any other piece of code. The function <code>base_network</code> is the only one I have changed it.</p>
  
  <p>By the way, <code>input_dim</code> is <code>(1, 56, 46)</code>.</p>
  
  <p>What am I doing wrong?</p>