Spaces:
Sleeping
Sleeping
Create device/get_device_id.py
Browse files- device/get_device_id.py +7 -0
device/get_device_id.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
|
| 3 |
+
def get_device_id():
|
| 4 |
+
if torch.cuda.is_available():
|
| 5 |
+
return 0
|
| 6 |
+
|
| 7 |
+
return -1
|