title: How can I pretrain for a multi-input DNN for Keras
body: <p>I'm currently developing a model using Keras + Tensorflow in order to determine the temperature range of a set of proteins. What I first did was create a pre-trained model that converts the proteins into embeddings and then predicts its respective temperature.</p>
  <p>What I want to do now is incorporate this pre=trained model to a new model which can use this given model and respective weights as input. Then fit on a new dataset and predict once again. The following code for the new top model is:</p>
  <h2>UPDATED CODE</h2>
  <pre><code>'Load Pretrained Model'
  loaded_model = keras.models.load_model('pretrained_model')
  
  #Freeze all model layer weights
  loaded_model.trainable = False
  
  input1 = np.expand_dims(x_train['input1'],1)
  input2 = np.expand_dims(x_train['input2'], 1)
  input3 = x_train['input3']
  
  #Redefine Input Layers for ANN
  input1 = Input(shape = (input1.shape[1],), name = &quot;input1&quot;)
  input2 = Input(shape = (input2.shape[1],), name = &quot;input2&quot;)
  input3 = Input(shape = (input3.shape[1],), name = &quot;input2&quot;)
  
  base_inputs = [input1, input2, input3]
  
  x = loaded_model(base_inputs, training = False)
  x = Dense(64, activation = &quot;relu&quot;,  kernel_regularizer=regularizers.l2(0.01))(x)
  
  output = Dense(1, activation = &quot;sigmoid&quot;)(x)
  
  top_model = Model(inputs = base_inputs, outputs = output)
  
  # Compile the Model
  top_model.compile(loss='mse', optimizer = Adam(lr = 0.0001), metrics = ['mse'])
  </code></pre>
  <p>This is not working correctly and I'm not sure on how to get this up and running. I'm struggling a bit to get this and come across this error quite often:</p>
  <pre><code>AttributeError: 'Dense' object has no attribute 'shape'
  </code></pre>
  <p>Any thoughts?</p>