Search code examples
pythontensorflowattributeerror

Tensorflow: 'module' object has no attribute 'RunMetaData'


I am trying to get GPU/CPU time stats using tensorflow timeline module but on

 run_metadata = tf.RunMetaData()

It gives following error.

AttributeError: 'module' object has no attribute 'RunMetaData'

I am using 0.10.0rc0 version. I also go to tensorflow/python/client/timeline.py to actually see the function definition but It didn't exist there. P.S: I have imported from tensorflow.python.client import timeline
[Code snippet]

cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(y_conv, y_))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
correct_prediction = tf.equal(tf.argmax(y_conv,1), tf.argmax(y_,1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunOutputs()
sess.run(tf.initialize_all_variables())


[ERROR SNIPPET]

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-0dd6887f3319> in <module>()
     90 
     91 run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
---> 92 run_metadata = tf.RunMetaData()
     93 sess.run(tf.initialize_all_variables())
     94 

AttributeError: 'module' object has no attribute 'RunMetaData'

Solution

  • I needed to install TensorFlow 0.12.0 or higher.