title: Visualizing feature maps for VGG16
body: <p>I'm using tf2.3.0 and python3.6</p>
  <p>Here is how I load the model</p>
  <pre><code>from __future__ import absolute_import, division, print_function
  import tensorflow as tf
  import tensorflow.keras as keras
  import tensorflow.keras.layers as layers
  import numpy as np
  from tensorflow.keras.applications import VGG16
  from tensorflow.keras.applications import resnet
  import matplotlib.pyplot as plt
  
  def create_vgg():
      vgg16 = VGG16(include_top=False, weights='imagenet',input_shape=(224,224,3))
      inputs = keras.Input(shape=(224,224,3))
      bn = layers.BatchNormalization()(inputs)
      x = vgg16(bn)
      x = layers.Conv2D(256,kernel_size=(1,1),activation='relu',name='conv2D',kernel_regularizer=keras.regularizers.l2(0.001))(x)
      flat_out = layers.Flatten()(x)
      h1 = layers.Dense(1024,activation='relu',name='fc1',kernel_regularizer=keras.regularizers.l2(0.001))(flat_out)
      h2 = layers.Dropout(0.5)(h1)
      h3 = layers.Dense(32,activation='relu',name='fc2',kernel_regularizer=keras.regularizers.l2(0.001))(h2)
      h4 = layers.Dropout(0.5)(h3)
      new_out = layers.Dense(1,activation='sigmoid',name='prediction')(h4)
      return keras.Model(inputs,new_out)
  
  vgg = create_vgg()
  vgg.load_weights('F:\\logs\\best_weight.h5')
  vgg.compile(optimizer=keras.optimizers.Adam(5e-6),
              loss=&quot;binary_crossentropy&quot;, metrics=['accuracy'])
  
  </code></pre>
  <p>And I want to visualize all the feature maps of the 16 former layers:</p>
  <pre><code>output_layers = [layer.output for layer in vgg.layers[:16]]
  activation_model = keras.models.Model(inputs=vgg.input,outputs=output_layers)
  </code></pre>
  <p>I got an error while executing the last line:</p>
  <pre><code>ValueError: Graph disconnected: cannot obtain value for tensor Tensor(&quot;input_1:0&quot;, shape=(None, 224, 224, 3), dtype=float32) at layer &quot;block1_conv1&quot;. The following previous layers were accessed without issue: []
  
  </code></pre>
  <p>How can I fix this</p>