title: TensorFlow: Is there a way to measure FLOPS for a model?
body: <p>The closest example I can get is found in this issue: <a href="https://github.com/tensorflow/tensorflow/issues/899" rel="noreferrer">https://github.com/tensorflow/tensorflow/issues/899</a></p>
  
  <p>With this minimum reproducible code:</p>
  
  <pre><code>import tensorflow as tf
  import tensorflow.python.framework.ops as ops 
  g = tf.Graph()
  with g.as_default():
    A = tf.Variable(tf.random_normal( [25,16] ))
    B = tf.Variable(tf.random_normal( [16,9] ))
    C = tf.matmul(A,B) # shape=[25,9]
  for op in g.get_operations():
    flops = ops.get_stats_for_node_def(g, op.node_def, 'flops').value
    if flops is not None:
      print 'Flops should be ~',2*25*16*9
      print '25 x 25 x 9 would be',2*25*25*9 # ignores internal dim, repeats first
      print 'TF stats gives',flops
  </code></pre>
  
  <p>However, the FLOPS returned is always None. Is there a way to concretely measure FLOPS, especially with a PB file?</p>