title: Combine multiple outputs in tensorflowjs
body: <p>I have been given a model by a college and want to use it to create a heatmap.
  To do so, i need to get the result of the last convolutional layer. So I've tried to create a new model using the definitions of the old. I've seen this is possible in python and it seems it should be possible according to the docs.</p>
  
  <p>My code looks something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>const combined_output_model = (cam_model) =&gt; {
      const conv_layer = cam_model.layers.length - 3
      const input_layer = cam_model.input
      const output_layer = cam_model.layers[conv_layer].output
      return model = tf.model(
          inputs=input_layer,
          outputs=output_layer
      )
  
  </code></pre>
  
  <p>However, when I run the code I get the following error:</p>
  
  <pre class="lang-js prettyprint-override"><code>container.ts:156 Uncaught (in promise) TypeError: Cannot read property 'sourceLayer' of undefined
      at e [as constructor] (container.ts:156)
      at new e (training.ts:483)
      at Object.t.model (exports.ts:74)
      at predictor (prediction.js:28)
  </code></pre>
  
  <p>when looking at both <code>input_layer</code> and <code>output_layer</code> in the local variables show they both have sourceLayers </p>
  
  <p>Any help appreciated.</p>
  
  <p>Regards</p>