title: KeyError: "The name 'loss:0' refers to a Tensor which does not exist. The operation, 'loss', does not exist in the graph."
body: <blockquote>
    <p>KeyError: "The name 'loss:0' refers to a Tensor which does not exist. The operation, 'loss', does not exist in the graph."</p>
  </blockquote>
  
  <p><strong>Hey guys, i'm facing an issue while using the tensorflow model. The code is running fine when it compiled in terminal but when i try to make it an python API it shows the above error</strong></p>
  
  <pre><code>output_layer = 'loss:0'
  input_node = 'Placeholder:0'
  
  # Crop the center for the specified network_input_Size
  augmented_image = crop_center(augmented_image, network_input_size, network_input_size)
  
  
  with tf.Session() as sess:
      prob_tensor = sess.graph.get_tensor_by_name(output_layer)
      predictions = sess.run(prob_tensor, {input_node: [augmented_image] })
  </code></pre>
  
  <p>The above code is saying an error at </p>
  
  <p><code>prob_tensor = sess.graph.get_tensor_by_name(output_layer)</code></p>