Skip to content

Commit

Permalink
Update torch_utils.py (ultralytics#1895)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jan 10, 2021
1 parent bac2372 commit ec50784
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def select_device(device='', batch_size=None):
os.environ['CUDA_VISIBLE_DEVICES'] = device # set environment variable
assert torch.cuda.is_available(), f'CUDA unavailable, invalid device {device} requested' # check availability

cuda = torch.cuda.is_available() and not cpu
cuda = not cpu and torch.cuda.is_available()
if cuda:
n = torch.cuda.device_count()
if n > 1 and batch_size: # check that batch_size is compatible with device_count
Expand Down

0 comments on commit ec50784

Please sign in to comment.