title: Keras (Tensorflow backend) Error - Tensor input_1:0, specified in either feed_devices or fetch_devices was not found in the Graph
body: <p>When trying to predict using a simple model I've previously trained I get the following error:</p>
  
  <p><strong>Tensor input_1:0, specified in either feed_devices or fetch_devices was not found in the Graph</strong></p>
  
  <p>at line:</p>
  
  <pre><code>seatbelt_model.predict(image_arr, verbose=1)
  </code></pre>
  
  <p>in code:</p>
  
  <pre><code>from tensorflow import keras
  import tensorflow as tf
  import numpy as np
  
  graph = tf.get_default_graph()
  
  seatbelt_model = keras.models.load_model(filepath='./graphs/seatbelt_A_3_81.h5')
  
  class SeatbeltPredictor:
      INPUT_SHAPE = (-1, 120, 160, 1)
  
      @staticmethod
      def predict_seatbelt(image_arr):
          with graph.as_default():
              image_arr = np.array(image_arr).reshape(SeatbeltPredictor.INPUT_SHAPE)
              predicted_labels = seatbelt_model.predict(image_arr, verbose=1)
              return predicted_labels
  </code></pre>
  
  <p>The model has the following shape:</p>
  
  <pre><code>input_layer = keras.layers.Input(shape=(IMAGE_HEIGHT, IMAGE_WIDTH, 1))
  conv_0 = keras.layers.Conv2D(filters=32, kernel_size=[5, 5], activation=tf.nn.relu, padding="SAME")(input_layer)
  pool_0 = keras.layers.MaxPool2D(pool_size=[2, 2], strides=2, padding="VALID")(conv_0)
  conv_1 = keras.layers.Conv2D(filters=32, kernel_size=[5, 5], activation=tf.nn.relu, padding="SAME")(pool_0)
  pool_1 = keras.layers.MaxPool2D(pool_size=[2, 2], strides=2, padding="VALID")(conv_1)
  flat_0 = keras.layers.Flatten()(pool_1)
  dense_0 = keras.layers.Dense(units=1024, activation=tf.nn.relu)(flat_0)
  drop_0 = keras.layers.Dropout(rate=0.4, trainable=True)(dense_0)
  dense_1 = keras.layers.Dense(units=2, activation=tf.nn.softmax)(drop_0)
  </code></pre>
  
  <p>If I run the following, I get a tensor result:</p>
  
  <pre><code>graph.get_tensor_by_name('input_1:0')
  &lt;tf.Tensor 'input_1:0' shape=(?, 120, 160, 1) dtype=float32&gt;
  </code></pre>
  
  <p>The name of the first layer is input_1</p>
  
  <p>image_arr is of shape (1, 120, 160, 1)</p>
  
  <p>Tensorflow 1.12</p>
  
  <p>Any ideas?</p>