当使用多GPU培训和测试时,如何使用tensorflowslim的batchnornlization?

2024-04-19 19:28:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用batchnorm如下:

slim.batch_norm(inputs, decay=0.9, epsilon=0.001, updates_collections=tf.GraphKeys.UPDATE_OPS,
                        scale=False, fused=True, is_training=is_training)

手动应用梯度平均,使用四个GPU

update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
    with tf.control_dependencies(update_ops):
        apply_gradient_op = g_optim_init.apply_gradients(grads, global_step=global_step)

训练时网络正常,但测试时输出错误结果 我将状态从“真”更改为“假”


Tags: normistfstepbatchtrainingupdateglobal