Spaces:
Runtime error
Runtime error
Download modules/dml/utils.py from bilegentile/test: direct link, hf CLI and curl.
- Browser
- Download file 248 Bytes
-
https://huggingface.co/spaces/bilegentile/test/resolve/refs%2Fpr%2F3/modules/dml/utils.py
- Command line
-
hf download hf://spaces/bilegentile/test@refs/pr/3/modules/dml/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/bilegentile/test/resolve/refs%2Fpr%2F3/modules/dml/utils.py
248 Bytes
| from typing import Optional, Union | |
| import torch | |
| rDevice = Union[torch.device, int] | |
| def get_device(device: Optional[rDevice]=None) -> torch.device: | |
| if device is None: | |
| device = torch.dml.current_device() | |
| return torch.device(device) | |