Set if memory growth should be enabled for a PhysicalDevice.
(self, dev, enable)
| 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.""" |