def gnr_graph_checkpoint():
"""
???????checkpoint
:return:
"""
I = tf.placeholder(tf.float32, shape=[None, 3], name='I') # input
W = tf.Variable(tf.zeros(shape=[3, 2]), dtype=tf.float32, name='W') # weights
b = tf.Variable(tf.zeros(shape=[2]), dtype=tf.float32, name='b') # biases
O = tf.nn.relu(tf.matmul(I, W) + b, name='O') # activation / output
saver = tf.train.Saver()
init_op = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init_op)
tf.train.write_graph(sess.graph_def, MODEL_FOLDER, 'tfdroid.pbtxt') # ??TensorFlow??
# ???????????
sess.run(tf.assign(W, [[1, 2], [4, 5], [7, 8]]))
sess.run(tf.assign(b, [1, 1]))
# ??checkpoint????????
saver.save(sess, MODEL_FOLDER + 'tfdroid.ckpt')
评论列表
文章目录