Skip to content

Commit 1f34fca

Browse files
authored
Merge pull request #3141 from yaroslavvb/patch-1
assert fails on requesting gpus when not available
2 parents 5fa2a4e + 6b9d5fb commit 1f34fca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tutorials/image/cifar10_estimator/cifar10_main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ def main(job_dir, data_dir, num_gpus, variable_strategy,
503503
help='Epsilon for batch norm.')
504504
args = parser.parse_args()
505505

506+
if args.num_gpus > 0:
507+
assert tf.test.is_gpu_available(), "Requested GPUs but none found."
506508
if args.num_gpus < 0:
507509
raise ValueError(
508510
'Invalid GPU count: \"--num-gpus\" must be 0 or a positive integer.')

0 commit comments

Comments
 (0)