我正在尝试使用tf.contrib.distribute.MirroredStrategy作为tf.estimator.RunConfig的参数,在我的tensorflow训练代码中添加多gpu支持。loss=loss, train_op=train_op)
distribution = tf.contrib.distribute.MirroredStrategy
我想知道设置创建/训练模型的设备以优化资源使用的正确方法是什么,以便使用Keras在TensorFlow中进行快速培训?我有1个CPU和2个GPU可供我使用。最初,我使用tf.device上下文来创建模型并仅在CPU上进行培训,但后来我在TensorFlow文档中看到了,它们建议在CPU上显式实例化模型:# so that the model's weights are hosted on CPU memory.