为什么在 keras 中设置多个 GPU,只有一个在运行?

这是我正在使用的 api,来自办公网站keras Multi-GPU

我使用镜像策略:

cross_device_ops = tf.distribute.HierarchicalCopyAllReduce()
strategy = tf.distribute.MirroredStrategy(["device:GPU:%d" % i for i in range(2)],cross_device_ops=cross_device_ops)  #,"/gpu:1","/gpu:0"]
print('Number of devices: {}'.format(strategy.num_replicas_in_sync))  # out 2

# Open a strategy scope.
with strategy.scope():
    model = UNet()
model.summary()
model.compile(optimizer=Adam(lr=0.0001),loss=dice_coef_loss,metrics=[dice_coef])
wz17266 回答:为什么在 keras 中设置多个 GPU,只有一个在运行?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/321499.html

大家都在问