tf.config.experimental.set_memory_growth
| Просмотреть исходный код на GitHub |
Устанавливает, нужно ли разрешить увеличение памяти для PhysicalDevice.
tf.config.experimental.set_memory_growth(
device, enable
)
PhysicalDevice с включённым увеличением памяти не будет выделять всю память на устройстве сразу. Увеличение памяти не может быть настроено на PhysicalDevice с настроенными виртуальными устройствами.
Например:
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
tf.config.experimental.set_memory_growth(physical_devices[0], True)
| Аргументы | |
|---|---|
device | PhysicalDevice для настройки |
enable | Нужно ли включить или отключить увеличение памяти |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/config/experimental/set_memory_growth