几个重要的概念:
1.Graph
系统自动维护一个默认的计算图(一般一个图)
tf.get_default_graph()#获取默认计算图
g = tf.Graph()
with g.as_default():#设置默认图
with g.device('/gpu:0'): #指定计算运行设备
2.tensor
属性 name, shape, type
3.Session
sess = tf.Session(0
sess.run()
sess.close()
或者
with tf.Sessioon() as sess:
sess.run()
前向传播算法
tf.Variable()
tf.matmul(,)
tf.initialize_all_variables() 变成了 tf.global_variables_initializer()
网友评论