Skip to content

Commit

Permalink
fix gpus -1 for CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Aug 6, 2021
1 parent 69f287e commit 6cd50d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pytorch_lightning/utilities/device_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ def _normalize_parse_gpu_input_to_list(gpus: Union[int, List[int], Tuple[int, ..
return list(range(gpus))


def _get_all_available_gpus() -> List[int]:
def _get_all_available_gpus() -> Optional[List[int]]:
"""
Returns:
a list of all available gpus
"""
if not torch.cuda.is_available():
return None
return list(range(torch.cuda.device_count()))


Expand Down

0 comments on commit 6cd50d2

Please sign in to comment.