Why am I getting an error importing a Tensorflow module?

I am trying to use TensorFlow service. I installed TensorFlow using these instructions.

When I tried to use this line in my python code

from tensorflow_serving.session_bundle import exporter

      

I have a problem

>>> from tensorflow_serving.session_bundle import exporter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow_serving.session_bundle

      

Why am I getting this problem? Am I missing something to create TensorFlow to include this module?

PS: Hello World TensorFlow app works fine in my setup.

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

      

+3


source to share


1 answer


After spending countless hours I was able to find a solution.

When I changed the line

from tensorflow_serving.session_bundle import exporter

      



to

from tensorflow.contrib.session_bundle import exporter

      

It seems the TF developers decided to change their session_bundle package location in the source tree.

+2


source







All Articles