tf.config.experimental.get_memory_growth
Stay organized with collections
Save and categorize content based on your preferences.
Get if memory growth is enabled for a PhysicalDevice.
tf.config.experimental.get_memory_growth(
device
)
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.config.experimental.get_memory_growth\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/config/experimental/get_memory_growth) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/framework/config.py#L409-L431) |\n\nGet if memory growth is enabled for a PhysicalDevice.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.config.experimental.get_memory_growth`](/api_docs/python/tf/config/experimental/get_memory_growth), \\`tf.compat.v2.config.experimental.get_memory_growth\\`\n\n\u003cbr /\u003e\n\n tf.config.experimental.get_memory_growth(\n device\n )\n\nA PhysicalDevice with memory growth set will not allocate all memory on the\ndevice upfront.\n\n#### For example:\n\n physical_devices = config.experimental.list_physical_devices('GPU')\n assert len(physical_devices) \u003e 0, \"Not enough GPU hardware devices available\"\n tf.config.experimental.set_memory_growth(physical_devices[0], True)\n assert tf.config.experimental.get_memory_growth(physical_devices[0]) == True\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------|-------------------------|\n| `device` | PhysicalDevice to query |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Current memory growth setting. ||\n\n\u003cbr /\u003e"]]