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

Method set_memory_growth

tensorflow/python/eager/context.py:1203–1224  ·  view source on GitHub ↗

Set if memory growth should be enabled for a PhysicalDevice.

(self, dev, enable)

Source from the content-addressed store, hash-verified

1201 return self._memory_growth_map[dev]
1202
1203 def set_memory_growth(self, dev, enable):
1204 """Set if memory growth should be enabled for a PhysicalDevice."""
1205 self._initialize_physical_devices()
1206
1207 if dev not in self._physical_devices:
1208 raise ValueError("Unrecognized device: %s" % repr(dev))
1209
1210 if dev in self._virtual_device_map:
1211 raise ValueError(
1212 "Cannot set memory growth on device when virtual devices configured")
1213
1214 if dev.device_type != "GPU":
1215 raise ValueError("Cannot set memory growth on non-GPU devices")
1216
1217 if self._memory_growth_map.get(dev) == enable:
1218 return
1219
1220 if self._context_handle is not None:
1221 raise RuntimeError(
1222 "Physical devices cannot be modified after being initialized")
1223
1224 self._memory_growth_map[dev] = enable
1225
1226 def get_virtual_device_configuration(self, dev):
1227 """Get the virtual device configuration for a PhysicalDevice."""

Callers 4

set_memory_growthFunction · 0.80
testGpuGrowthMethod · 0.80
testGpuInvalidConfigMethod · 0.80
demo.pyFile · 0.80

Calls 2

getMethod · 0.45

Tested by 2

testGpuGrowthMethod · 0.64
testGpuInvalidConfigMethod · 0.64