tensorflow中bn的使用

1 损失函数得这样定义才行
2 training训练的时候True,预测的时候False

out = tf.layers.batch_normalization(out, training=is_training)

update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
    cross_entropy = tf.reduce_mean( tf.nn.softmax_cross_entropy_with_logits_v2(labels=y,logits=out) )

你可能感兴趣的:(深度学习)