tensorflow-handbook icon indicating copy to clipboard operation
tensorflow-handbook copied to clipboard

设置显存使用策略

Open moriwang opened this issue 5 years ago • 0 comments

设置显存按需使用的 code 报错。

gpus = tf.config.experimental.list_physical_devices(device_type='GPU')
for gpu in gpus:
    tf.config.experimental.set_memory_growth(device=gpu, True)

显示 SyntaxError: positional arguments follows keyword argument

第三行需要修改一下才能运行

tf.config.experimental.set_memory_growth(gpu, True)
或
tf.config.experimental.set_memory_growth(device=gpu, enable=True)

moriwang avatar Nov 15 '19 02:11 moriwang