Skip to content

Commit

Permalink
Maintaining Project Compatibility for Python 3.9 Users Without Upgrad…
Browse files Browse the repository at this point in the history
…e Requirements.

Sole usage of Python 3.10 is match-case in the project hinders quick-start for beginners; consider replacing with if-else for improved accessibility
  • Loading branch information
cuba3 committed Jun 25, 2024
1 parent a8fba9a commit 25ece08
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def get_param(model) -> torch.nn.Parameter:

def float64(t: torch.Tensor):
"""return torch.float64 if device is not mps or xpu, else return torch.float32"""
match t.device.type:
case 'mps', 'xpu':
return torch.float32
# match t.device.type:
# case 'mps', 'xpu':
# return torch.float32
if t.device.type in ['mps', 'xpu']:
return torch.float32
return torch.float64

0 comments on commit 25ece08

Please sign in to comment.