我有下面的示例tensorflow代码
import tensorflow as tf
with tf.device('/cpu:0'):
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)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print(sess)
print(sess.run(c))
我已经明确表示tf.装置('/cpu:0'但它给出了以下错误:
^{pr2}$Tensorflow版本:1.3.0, python版本:3.6.1和Anaconda发行版
我运行了这个程序,结果如下:
看来matmul正在GPU上结束,而你的GPU不可用。我有相同版本的Tensorflow,但是python3.5.4。在
相关问题 更多 >
编程相关推荐