测试Tensorflow-GPU的例子
import tensorflow as tf
# import os
# os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
a = tf.placeholder(tf.int16)
b = tf.placeholder(tf.int16)
add = tf.add(a, b)
mul = tf.multiply(a, b)
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
with tf.Session(config=config) as sess:
print(sess.run(add, feed_dict={a: 3, b: 4}))
print(sess.run(mul, feed_dict={a: 3, b: 4}))
print(sess.run([add, mul], feed_dict={a: 3, b: 4}))


浙公网安备 33010602011771号