Save the date! Google I/O returns May 18-20 Register now


Get the memory usage, in bytes, for the chosen device.

See for specifying device strings.

For example:

gpu_devices = tf.config.list_physical_devices('GPU')
if gpu_devices:

Does not work for CPU.

device Device string to get the bytes in use for.

Total memory usage in bytes.

ValueError Non-existent or CPU device specified.