Skip to content

Commit

Permalink
Merge pull request tensorflow#3141 from yaroslavvb/patch-1
Browse files Browse the repository at this point in the history
assert fails on requesting gpus when not available
  • Loading branch information
tfboyd authored Jan 24, 2018
2 parents 5fa2a4e + 6b9d5fb commit 1f34fca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tutorials/image/cifar10_estimator/cifar10_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ def main(job_dir, data_dir, num_gpus, variable_strategy,
help='Epsilon for batch norm.')
args = parser.parse_args()

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

0 comments on commit 1f34fca

Please sign in to comment.