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}))
原文:https://www.cnblogs.com/cwj2019/p/11844944.html