title: Quantizing a TensorFlow graph for inference
body: <p>I'm trying to quantize my model (a CNN) in order to convert it to a quantized .tflite model. 
  I'm following the tutorial at: <a href="https://github.com/tensorflow/tensorflow/tree/r1.13/tensorflow/contrib/quantize#quantization-aware-training" rel="nofollow noreferrer">https://github.com/tensorflow/tensorflow/tree/r1.13/tensorflow/contrib/quantize#quantization-aware-training</a> </p>
  
  <p>First of all, I introduce fake quantization nodes in my graph by calling:</p>
  
  <pre><code>tf.contrib.quantize.create_training_graph(quant_delay=500)
  </code></pre>
  
  <p>but then, when at the end I try to to call this function to make sure that the graph is exported with the quantization information in the right format:</p>
  
  <pre><code>tf.contrib.quantize.create_eval_graph(input_graph=tf.get_default_graph())
  </code></pre>
  
  <p>I get this error: </p>
  
  <p><strong><code>ValueError: Training op found in graph, exiting {'ApplyAdam'}</code></strong></p>
  
  <p>and indeed, when building the graph, I effectively added an AdamOptimizer to train my model:</p>
  
  <pre><code>train_step = tf.train.AdamOptimizer(1e-4).minimize(...)
  </code></pre>
  
  <p>How to solve that problem? The error seems to suggest that I should remove the Adam optimizer, although I need it for training.</p>
  
  <p>I couldn't find any help about this on TensorFlow web pages and tutorials nor in other forums. I hope you can help me out</p>
  
  <p>Thanks in advance</p>