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) )

猜你喜欢

转载自blog.csdn.net/masbbx123/article/details/86469667
BN