如何在不使用bazel的情况下执行TensorFlow服务示例mnist_export?

时间:2017-07-12 09:31:55

标签: python tensorflow deep-learning tensorflow-serving

我安装了TensorFlow的所有先决条件,作为explained here

当我尝试在我的Ubuntu 16.04机器中使用以下行运行默认的mnist示例时:

python  mnist_export.py --training_iteration=1000 --export_version=1 export_models

我收到以下错误:

Traceback (most recent call last):
  File "mnist_export.py", line 40, in <module>
    from tensorflow_serving.example import mnist_input_data
ImportError: No module named tensorflow_serving.example

该代码为available here

然而,当我使用bazel构建如下时,它完美地运作:

bazel-bin/tensorflow_serving/example/mnist_export --training_iteration=1000 --export_version=1 export_models

1 个答案:

答案 0 :(得分:2)

通过更改以下行来解决此问题:

from tensorflow_serving.example import mnist_input_data

到这一行:

from tensorflow.contrib.learn.python.learn.datasets import mnist as mnist_input_data

此问题为discussed here