Source code for pytomography
import torch
[docs]device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
if device == "cpu":
print("PyTomography did not find a GPU available on this machine. If this is not expected, please check your CUDA installation.")
from importlib.metadata import version
[docs]__version__: str = version('pytomography')
[docs]def set_dtype(dt):
global dtype
global delta
dtype = dt
torch.set_default_dtype(dt)
if dt==torch.float16:
delta = 1e-5
elif dt==torch.float32:
delta = 1e-11
[docs]def set_device(d):
global device
device = d