Source code for mgplvm.utils
import torch
from typing import Optional
default_jitter = 1E-8
[docs]def get_device(device: str = "cuda"):
if torch.cuda.is_available() and device == "cuda":
mydevice = torch.device(device)
else:
mydevice = torch.device('cpu')
# need to allow multiple instances of openMP
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
return mydevice