作者sheman (夜露死苦)
看板Python
标题[问题] tensorflow的session问题
时间Mon Oct 5 20:54:56 2020
想请教版上大大
小弟在Anaconda的环境下使用tensorflow 1.15版
只是简单先跑个程式,程式码如下:
import tensorflow as tf
x = tf.constant([[1, 2],[3, 4]], name='x')
y = tf.constant([[5, 6],[7, 8]], name='y')
with tf.Session() as sess:
print("y: {}\n".format(sess.run(y)))
没想到出现以下的错误讯息:
InternalError Traceback (most recent call last)
<ipython-input-5-abbc1cf59ac4> in <module>
10 # tf_neg = -x
11
---> 12 with tf.Session() as sess:
13
14 print("y: {}\n".format(sess.run(y)))
~\anaconda3\envs\DL\lib\site-packages\tensorflow_core\python\client\session.py
in __init__(self, target, graph, config)
1583 protocol buffer with configuration options for the session.
1584 """
-> 1585 super(Session, self).__init__(target, graph, config=config)
1586 # NOTE(mrry): Create these on first `__enter__` to avoid a
reference cycle.
1587 self._default_graph_context_manager = None
~\anaconda3\envs\DL\lib\site-packages\tensorflow_core\python\client\session.py
in __init__(self, target, graph, config)
672
673 if config is None:
--> 674 config = context.context().config
675
676 if not isinstance(config, config_pb2.ConfigProto):
~\anaconda3\envs\DL\lib\site-packages\tensorflow_core\python\eager\context.py
in config(self)
799 """Return the ConfigProto with all runtime deltas applied."""
800 # Ensure physical devices have been discovered and config has
been imported
--> 801 self._initialize_physical_devices()
802
803 config = config_pb2.ConfigProto()
~\anaconda3\envs\DL\lib\site-packages\tensorflow_core\python\eager\context.py
in _initialize_physical_devices(self)
1052 return
1053
-> 1054 devs = pywrap_tensorflow.TF_ListPhysicalDevices()
1055 self._physical_devices = [
1056 PhysicalDevice(name=d.decode(),
InternalError: failed to get compute capability major for device: UNKNOWN
ERROR (1); 0
我自己找了好久都找不到答案,想请问这大概是发生什麽样的错误?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.168.35.78 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1601902498.A.2F3.html
1F:推 yiche: 你装的是gpu版本的TensorFlow吗? 10/05 23:49
2F:→ s59654655: 仔细看错误提示!找不到gpu,安装cpu版本吧 10/06 00:00
3F:→ pmove: 想办法建个GPU环境再跑吧? 10/06 17:17
4F:→ sheman: 感谢大大建议,问题解决了!! 10/06 21:52