Use stable functions (#9369)

This commit is contained in:
Julien Plu
2021-01-05 09:58:26 +01:00
committed by GitHub
parent 4aa8f6ad99
commit 4225740a7b
5 changed files with 12 additions and 26 deletions

View File

@@ -51,10 +51,10 @@ if is_tf_available():
for gpu in gpus:
# Restrict TensorFlow to only allocate x GB of memory on the GPUs
try:
tf.config.experimental.set_virtual_device_configuration(
gpu, [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=_tf_gpu_memory_limit)]
tf.config.set_logical_device_configuration(
gpu, [tf.config.LogicalDeviceConfiguration(memory_limit=_tf_gpu_memory_limit)]
)
logical_gpus = tf.config.experimental.list_logical_devices("GPU")
logical_gpus = tf.config.list_logical_devices("GPU")
print("Logical GPUs", logical_gpus)
except RuntimeError as e:
# Virtual devices must be set before GPUs have been initialized