MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_memory_growth

Function get_memory_growth

tensorflow/python/framework/config.py:477–498  ·  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: ```python physical_devices = config.experimental.list_physical_devices('GPU') assert len(physical_devices) > 0, "Not enough GP

(device)

Source from the content-addressed store, hash-verified

475
476@tf_export('config.experimental.get_memory_growth')
477def get_memory_growth(device):
478 """Get if memory growth is enabled for a PhysicalDevice.
479
480 A PhysicalDevice with memory growth set will not allocate all memory on the
481 device upfront.
482
483 For example:
484
485 ```python
486 physical_devices = config.experimental.list_physical_devices('GPU')
487 assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
488 tf.config.experimental.set_memory_growth(physical_devices[0], True)
489 assert tf.config.experimental.get_memory_growth(physical_devices[0]) == True
490 ```
491
492 Args:
493 device: PhysicalDevice to query
494
495 Returns:
496 Current memory growth setting.
497 """
498 return context.context().get_memory_growth(device)
499
500
501@tf_export('config.experimental.set_memory_growth')

Callers

nothing calls this directly

Calls 2

get_memory_growthMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected