本文共 302 字,大约阅读时间需要 1 分钟。
import numpyimport tensorflow as tfa = 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.run(c))
运行之后cmd显示如下信息
确认为GPU转载地址:http://tkmfb.baihongyu.com/