tf.config.experimental.get_memory_usage
Stay organized with collections
Save and categorize content based on your preferences.
Get the current memory usage, in bytes, for the chosen device. (deprecated)
tf . config . experimental . get_memory_usage (
device
)
Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Use tf.config.experimental.get_memory_info(device)['current'] instead.
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.
For example:
gpu_devices = tf . config . list_physical_devices ( & #x27;GPU')
if gpu_devices :
tf . config . experimental . get_memory_usage ( & #x27;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.
Args
device
Device string to get the bytes in use for, e.g. "GPU:0"
Returns
Total memory usage in bytes.
Raises
ValueError
Non-existent or CPU device specified.
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 2023-03-17 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-03-17 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-17 UTC."],[],[]]