这是我第二次完整地完成了tensorflow(gpu)的安装过程。这一次,当我在cmdactivate tensorflow
中运行时,如果我在python解释器中输入以下测试代码:
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
它成功地识别GPU并在其上运行矩阵函数。虽然Spyder和concoder在同一个测试中运行,但我说在同一个CPU上运行的是同一个代码。我该怎么解决呢?是什么原因造成的? 我要赢10分。在
任何帮助都会很有用的,提前谢谢你。在
谨致问候, 康尼
这不是这个星球上最好的解决方案,但以下几点对我很有效: 1打开命令。 2输入
activate tensorflow
三。输入spyder 4让它装东西。 现在上面的测试显示,tensorflow确实在GPU上运行。 这并不是一个好的解决方案,因为spyder的每次打开都必须如此。目前这是可行的。是的,默认情况下,它指向错误的tensorflow环境。我的问题是我不知道在cmd中运行的那个在我的计算机上的位置。当我设法解决这个问题时,我会更新答案。在相关问题 更多 >
编程相关推荐