mnist.py 文件源码

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

项目:a3c 作者: siemanko 项目源码 文件源码
def build_graph(reuse):
    with tf.variable_scope('model', reuse=reuse):
        x = tf.placeholder(tf.float32, shape=[None, 784])
        y_ = tf.placeholder(tf.float32, shape=[None, 10])
        keep_prob = tf.placeholder(tf.float32)

        y_conv = forward(x, keep_prob)

        cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y_conv), reduction_indices=[1]))

        train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)

        correct_prediction = tf.equal(tf.argmax(y_conv, 1), tf.argmax(y_, 1))

        num_correct = tf.reduce_sum(tf.cast(correct_prediction, tf.float32))

        no_op = tf.no_op()

        return x, y_, keep_prob, train_step, num_correct, no_op
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号