我正在尝试运行张量流示例。
这是我的设置:
Ubuntu 16.04
CUDA的回购ubuntu1604-8-0-local_8.0.44-1_amd64.deb
cudnn-8.0-Linux的x64的V5.0-ga.tgz
https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp35-cp35m-linux_x86_64.whl
我试过这个:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))
我看到了这个:
dan@e80:~/tf11 $
dan@e80:~/tf11 $ python tf10.py
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties:
name: GeForce 940MX
major: 5 minor: 0 memoryClockRate (GHz) 1.2415
pciBusID 0000:01:00.0
Total memory: 3.95GiB
Free memory: 3.50GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0)
b'Hello, TensorFlow!'
42
dan@e80:~/tf11 $
dan@e80:~/tf11 $
dan@e80:~/tf11 $
我试过这个:
我看到了这个:
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $ python mnist_with_summaries.py
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
Traceback (most recent call last):
File "mnist_with_summaries.py", line 205, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
TypeError: run() got an unexpected keyword argument 'argv'
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $
dan@e80:~/tensorflow/tensorflow/examples/tutorials/mnist $
我欢迎任何关于如何调试它的想法。
答案 0 :(得分:0)
最近argv
功能已添加到app.run()
。因此,要使其工作,您必须删除argv=...
参数或从源构建TensorFlow。
答案 1 :(得分:0)
我遇到了同样的问题。 正在使用master分支,并获得tensorflow存储库的发布解决了它。
git clone -b r0.11 https://github.com/tensorflow/tensorflow.git
如果您使用的是conda,请确保安装/升级到更新版本,如下所示: https://www.tensorflow.org/versions/r0.12/get_started/os_setup.html
1)创建一个名为tensorflow的conda环境:
"Python 2.7 "
$ conda create -n tensorflow python=2.7
"Python 3.4"
$ conda create -n tensorflow python=3.4
"Python 3.5"
$ conda create -n tensorflow python=3.5
2)激活tensorfow:
source activate tensorflow
3)安装
conda install -c jjhelmus tensorflow=0.10.0rc0
我选择作为conda包提供的特定版本。