1. 程式人生 > >驗證tensorflow版本是GPU還是CPU

驗證tensorflow版本是GPU還是CPU

net int pro igp .config enc log orf 4.0

reference: https://blog.csdn.net/zlase/article/details/79261348

import numpy
import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0], shape=[2, 2], name=‘a‘)
b = tf.constant([1.0, 2.0, 3.0, 4.0], shape=[2, 2], name=‘b‘)
c = tf.matmul(a, b)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print(sess.run(c))

驗證tensorflow版本是GPU還是CPU