【问题标题】:batch normalization parameters update in multi gpu tensorflow code?多GPU张量流代码中的批量标准化参数更新?
【发布时间】:2017-12-28 08:20:07
【问题描述】:

我写了一个多 GPU Cnn 代码

this link 他们在第 249 行发表了评论

# 只保留批量标准化更新操作 # 最后的塔。理想情况下,我们应该从所有塔中获取更新 # 但是这些统计数据积累得非常快,所以我们可以忽略 # 来自其他塔的其他统计数据,没有显着损害。

但是这个更新批量规范的代码(在第 253 行):

with tf.device('/gpu:%d' % i):
.
.
.
  batchnorm_updates = 
  tf.get_collection(slim.ops.UPDATE_OPS_COLLECTION,scope)

为所有塔(GPU)完成 那么这个更新的正确位置是什么?

【问题讨论】:

    标签: python tensorflow deep-learning distributed-computing batch-normalization


    【解决方案1】:

    我认为您对代码的理解有误。

    作为code中的for loop

    for i in range(FLAGS.num_gpus):
      with tf.device('/gpu:%d' % i):
        with tf.name_scope('%s_%d' % (inception.TOWER_NAME, i)) as scope:
    
          with slim.arg_scope([slim.variables.variable], device='/cpu:0'):
    
          ......
    
          batchnorm_updates = tf.get_collection(slim.ops.UPDATE_OPS_COLLECTION,
                                                scope)
    

    batchnorm_updates将在每个for loop之后被替换,因此它只包含for loop完成时最后一个塔的批量标准化更新操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-14
      • 1970-01-01
      • 2023-03-16
      相关资源
      最近更新 更多