(self)
| 486 | @test_util.run_gpu_only |
| 487 | @reset_eager |
| 488 | def testGpuGrowth(self): |
| 489 | gpus = config.list_physical_devices('GPU') |
| 490 | self.assertNotEqual(len(gpus), 0) |
| 491 | |
| 492 | self.assertIsNone(config.get_memory_growth(gpus[-1])) |
| 493 | for gpu in gpus: |
| 494 | config.set_memory_growth(gpu, True) |
| 495 | |
| 496 | c = context.context().config |
| 497 | self.assertTrue(c.gpu_options.allow_growth) |
| 498 | |
| 499 | logical_gpus = config.list_logical_devices('GPU') |
| 500 | self.assertTrue(len(logical_gpus), len(gpus)) |
| 501 | |
| 502 | # Modifying the GPU configuration is not supported |
| 503 | with self.assertRaisesRegexp(RuntimeError, 'cannot be modified'): |
| 504 | for gpu in gpus: |
| 505 | config.set_memory_growth(gpu, False) |
| 506 | |
| 507 | # Setting the same GPU configuration is fine |
| 508 | for gpu in gpus: |
| 509 | config.set_memory_growth(gpu, True) |
| 510 | |
| 511 | @test_util.run_gpu_only |
| 512 | @reset_eager |
nothing calls this directly
no test coverage detected