0
我在tensorflow上使用多GPU。而且我对在相同范围内共享变量感到困惑。tensorflow多GPU共享变量
根据https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10/cifar10_multi_gpu_train.py
最简单的方法是:
for i in xrange(FLAGS.num_gpus):
with tf.device('/gpu:%d' % i):
tf.get_variable_scope().reuse_variables()
// and do sth.
但在我的理解,至少在第一GPU具有创建变量,因为它有它重用不变量。我还发现了一些代码,它为第一个GPU设置了reuse = False。
那么这样做的正确方法是什么?