title: Given an input and get two outputs
body: <p>I am using Tensorflow 2.4.0 and Ubuntu 16.04</p>
  <p>Given this model</p>
  <pre><code>base_model = tf.keras.applications.EfficientNetB0(weights=&quot;imagenet&quot;, include_top=False)
  base_model.trainable = base_model_trainable
  inputs = tf.keras.Input(shape=(IMG_SIZE,IMG_SIZE,3), name=&quot;input&quot;)
  x = tf.keras.applications.efficientnet.preprocess_input(inputs)
  # more details - https://www.tensorflow.org/tutorials/images/transfer_learning#important_note_about_batchnormalization_layers
  
  x = base_model(x,
                 training=False)  # training=training is needed only if there are layers with different behavior during training versus inference (e.g. Dropout)
  x = tf.keras.layers.GlobalAveragePooling2D()(x)
  x = tf.keras.layers.Dropout(0.2)(x)
  outputs = tf.keras.layers.Dense(len(class_names), name=&quot;output&quot;)(x)
  model = tf.keras.Model(inputs, outputs)
  </code></pre>
  <p>My objective is given the input to get the value  of <code>model.get_layer(&quot;efficientnetb0&quot;).output</code>,
  and <code>model.output</code></p>
  <p>if I do (a) (it does not give <code>model.get_layer(&quot;efficientnetb0&quot;).output</code>)</p>
  <pre><code>layer_name=&quot;efficientnetb0&quot;
  
  grad_model = tf.keras.models.Model([model.inputs], [model.output])
  </code></pre>
  <p>or (b) (it requires an additional input after preprocessing)</p>
  <pre><code>grad_model = tf.keras.models.Model([model.inputs, model.get_layer(layer_name).input], [model.get_layer(layer_name).output, model.output])
  </code></pre>
  <p>both works</p>
  <p>but if I do</p>
  <pre><code>grad_model = tf.keras.models.Model([model.inputs], [model.get_layer(layer_name).output, model.output])
  </code></pre>
  <p>It gives exception:</p>
  <pre><code>ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor(type_spec=TensorSpec(shape=(None, None, None, 3), dtype=tf.float32, name='input_1'), name='input_1', description=&quot;created by layer 'input_1'&quot;) at layer &quot;rescaling&quot;. The following previous layers were accessed without issue: []
  </code></pre>
  <p>What is the reason, and is there a way for me to pass in just an input and get two outputs?</p>