两种运行计算图的方式
import tensorflow as tf
a=tf.constant([1,2,3],name='a')
c=a+1
####1
with tf.Session as sess:
print(sess.run(c))
####2
sess=tf.Session()
with sess.as_default():
print(c.eval())
tensorflow中的一些接口:
tf.Graph()
tf.Graph.device()
tf.Graph.as_default()
tf.Session()
tf.Session.run()
tf.Session.as_default()
tf.constant()
tf.variable()
tf.get_variable()
tf.placeholder()
tf.train()
tf.train.GradientDescentOptimizer
tf.train.Saver
tf.nn()