View source on GitHub
|
Get the current memory usage, in bytes, for the chosen device. (deprecated)
tf.config.experimental.get_memory_usage(
device
)
This function is deprecated in favor of
tf.config.experimental.get_memory_info. Calling this function is equivalent
to calling tf.config.experimental.get_memory_info()['current'].
See https://www.tensorflow.org/api_docs/python/tf/device for specifying device strings.
gpu_devices = tf.config.list_physical_devices('GPU')if gpu_devices:tf.config.experimental.get_memory_usage('GPU:0')
Does not work for CPU.
For GPUs, TensorFlow will allocate all the memory by default, unless changed
with tf.config.experimental.set_memory_growth. This function only returns
the memory that TensorFlow is actually using, not the memory that TensorFlow
has allocated on the GPU.
device
"GPU:0"
ValueError
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. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.