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

Function set_memory_growth

tensorflow/python/framework/config.py:502–521  ·  view source on GitHub ↗

Set if memory growth should be enabled for a PhysicalDevice. A PhysicalDevice with memory growth set will not allocate all memory on the device upfront. Memory growth cannot be configured on a PhysicalDevice with virtual devices configured. For example: ```python physical_devices = tf

(device, enable)

Source from the content-addressed store, hash-verified

500
501@tf_export('config.experimental.set_memory_growth')
502def set_memory_growth(device, enable):
503 """Set if memory growth should be enabled for a PhysicalDevice.
504
505 A PhysicalDevice with memory growth set will not allocate all memory on the
506 device upfront. Memory growth cannot be configured on a PhysicalDevice with
507 virtual devices configured.
508
509 For example:
510
511 ```python
512 physical_devices = tf.config.experimental.list_physical_devices('GPU')
513 assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
514 tf.config.experimental.set_memory_growth(physical_devices[0], True)
515 ```
516
517 Args:
518 device: PhysicalDevice to configure
519 enable: Whether to enable or disable memory growth
520 """
521 context.context().set_memory_growth(device, enable)
522
523
524@tf_export('config.experimental.get_virtual_device_configuration')

Callers

nothing calls this directly

Calls 2

set_memory_growthMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected