hongbo-miao/hongbomiao.com

View on GitHub
machine-learning/convolutional-neural-network/src/utils/device.py

Summary

Maintainability
A
0 mins
Test Coverage
import torch

if torch.cuda.is_available():
    device = "cuda"
elif torch.backends.mps.is_available():
    device = "mps"
else:
    device = "cpu"