Skip to content

Commit d82ff4e

Browse files
authored
Merge pull request #182 from eigenvivek/fix-compile
Move dims to device for torch.compile
2 parents 4aa62c9 + f93aafc commit d82ff4e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

diffdrr/siddon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def siddon_raycast(
1515
eps: float = 1e-8,
1616
):
1717
"""An auto-differentiable implementation of the raycasting algorithm known as Siddon's method."""
18-
dims = torch.tensor(volume.shape) + 1
18+
dims = torch.tensor(volume.shape).to(source) + 1
1919
alphas, maxidx = _get_alphas(source, target, spacing, dims, eps)
2020
alphamid = (alphas[..., 0:-1] + alphas[..., 1:]) / 2
2121
voxels = _get_voxel(alphamid, source, target, volume, spacing, dims, maxidx, eps)

notebooks/api/01_siddon.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
" eps: float=1e-8,\n",
9292
"):\n",
9393
" \"\"\"An auto-differentiable implementation of the raycasting algorithm known as Siddon's method.\"\"\"\n",
94-
" dims = torch.tensor(volume.shape) + 1\n",
94+
" dims = torch.tensor(volume.shape).to(source) + 1\n",
9595
" alphas, maxidx = _get_alphas(source, target, spacing, dims, eps)\n",
9696
" alphamid = (alphas[..., 0:-1] + alphas[..., 1:]) / 2\n",
9797
" voxels = _get_voxel(alphamid, source, target, volume, spacing, dims, maxidx, eps)\n",

0 commit comments

Comments
 (0)