Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow: 'module' object has no attribute 'SessionRunHook'

I'm running TensorFlow version r0.10 on Ubuntu 16.04. I have been able to run some basic tutorials, including the MIST character recognition tutorial.

I'm trying to complete the CIFAR-10 tutorial example from TensorFlow, on tensorflow version r0.10.

When I execute cifar10_train.py

After: Filling queue with 20000 CIFAR images before starting to train. This will take a few minutes.

The script fails with:

File "cifar10_train.py", line 85, in train class _LoggerHook(tf.train.SessionRunHook): AttributeError: 'module' object has no attribute 'SessionRunHook'

Please could someone help me find the solution to this error?

Thank you

like image 288
John Avatar asked Oct 17 '22 21:10

John


1 Answers

The code you are trying to run is from a later version of the TensorFlow repository than the version you have installed:

  • The code that uses tf.train.SessionRunHook was added to the master branch on November 23rd, 2016, and is part of the r0.12 release.
  • The tf.train.SessionRunHook class itself was created on October 3rd, 2016, and first became part of an official release in r0.12.

TensorFlow tutorial code only works with the contemporary version of the library. To run the CIFAR-10 tutorial using r0.10, you should clone the r0.10 branch of the GitHub repository:

$ git clone -b r0.10 https://github.com/tensorflow/tensorflow.git
like image 124
mrry Avatar answered Oct 21 '22 05:10

mrry