tensorflow / 1.15.0 / config / experimental / get_memory_growth.html /

tf.config.experimental.get_memory_growth

View source on GitHub

Get if memory growth is enabled for a PhysicalDevice.

A PhysicalDevice with memory growth set will not allocate all memory on the device upfront.

For example:

physical_devices = 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)
assert tf.config.experimental.get_memory_growth(physical_devices[0]) == True
Args
device PhysicalDevice to query
Returns
Current memory growth setting.

© 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/get_memory_growth