title: How to load weights to PART of a NN (Keras)?
body: <p>I have two NNs, let's say, A and B.</p>
  <p>I have trained A, separately, while B is an EfficientNet based one.</p>
  <p>Then I want to create a combine them: <strong>input image -&gt; A -&gt; B -&gt;output</strong></p>
  <p>So I need to do something like:</p>
  <pre><code>  inputs = Input(shape=(IMAGE_SIZE, IMAGE_SIZE, 3))
    A = CreateA(inputs)
    B = createB(A)
    model = Model(inputs, B)
  
    model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])
  </code></pre>
  <p>Now, somewhere above (or below, I don't care) the &quot;compile&quot; I want to load stored weights of A.</p>
  <p>Those weights were stored with</p>
  <pre><code>checkpoint = ModelCheckpoint(best_weights_filepath, monitor=monitor, save_best_only=True, save_weights_only=True, mode=mode, verbose=1, save_freq='epoch')
  </code></pre>
  <p>The problem:</p>
  <p>It seems that I can not load weights before I call &quot;compile&quot;, but after I use call &quot;compile&quot;, it is a different NN (AB, instead of A) and it has different number of layers.</p>
  <p>So how do I load weights to A only?</p>