【发布时间】:2018-06-30 05:51:48
【问题描述】:
我正在尝试运行这个简单的代码来测试 tensorflow
from __future__ import print_function
import tensorflow as tf
a = tf.constant(2)
b = tf.constant(3)
with tf.Session() as sess:
print("a=2, b=3")
print("Addition with constants: %i" % sess.run(a+b))
但奇怪的是得到 GPU 同步失败的错误。
追溯:
runfile('D:/tf_examples-master/untitled3.py', wdir='D:/tf_examples-master')
a=2, b=3
Traceback (most recent call last):
File "<ipython-input-5-d4753a508b93>", line 1, in <module>
runfile('D:/tf_examples-master/untitled3.py', wdir='D:/tf_examples-master')
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/tf_examples-master/untitled3.py", line 15, in <module>
print("Multiplication with constants: %i" % sess.run(a*b))
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "C:\ProgramData\Anaconda3\envs\env3-gpu\lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
InternalError: GPU sync failed
任何帮助将不胜感激。
【问题讨论】:
标签: python python-3.x tensorflow