android_test.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:MachineLearningTutorial 作者: SpikeKing 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号