Spaces:
Runtime error
Runtime error
Download mmcv/tests/test_device/test_device_utils.py from ttxskk/AiOS: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/spaces/ttxskk/AiOS/resolve/main/mmcv/tests/test_device/test_device_utils.py
- Command line
-
hf download hf://spaces/ttxskk/AiOS/mmcv/tests/test_device/test_device_utils.py
-
curl -L -o test_device_utils.py https://huggingface.co/spaces/ttxskk/AiOS/resolve/main/mmcv/tests/test_device/test_device_utils.py
466 Bytes
| # Copyright (c) OpenMMLab. All rights reserved. | |
| from mmcv.device import get_device | |
| from mmcv.utils import IS_CUDA_AVAILABLE, IS_MLU_AVAILABLE, IS_MPS_AVAILABLE | |
| def test_get_device(): | |
| current_device = get_device() | |
| if IS_CUDA_AVAILABLE: | |
| assert current_device == 'cuda' | |
| elif IS_MLU_AVAILABLE: | |
| assert current_device == 'mlu' | |
| elif IS_MPS_AVAILABLE: | |
| assert current_device == 'mps' | |
| else: | |
| assert current_device == 'cpu' | |