diffct 1.2.4__tar.gz → 1.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. diffct-1.2.5/.github/workflows/release.yml +20 -0
  2. {diffct-1.2.4 → diffct-1.2.5}/PKG-INFO +1 -1
  3. {diffct-1.2.4 → diffct-1.2.5}/diffct/differentiable.py +5 -30
  4. {diffct-1.2.4 → diffct-1.2.5}/pyproject.toml +1 -1
  5. {diffct-1.2.4 → diffct-1.2.5}/.github/workflows/docs.yml +0 -0
  6. {diffct-1.2.4 → diffct-1.2.5}/.gitignore +0 -0
  7. {diffct-1.2.4 → diffct-1.2.5}/LICENSE +0 -0
  8. {diffct-1.2.4 → diffct-1.2.5}/README.md +0 -0
  9. {diffct-1.2.4 → diffct-1.2.5}/diffct/__init__.py +0 -0
  10. {diffct-1.2.4 → diffct-1.2.5}/docs/Makefile +0 -0
  11. {diffct-1.2.4 → diffct-1.2.5}/docs/source/_static/.gitkeep +0 -0
  12. {diffct-1.2.4 → diffct-1.2.5}/docs/source/api.rst +0 -0
  13. {diffct-1.2.4 → diffct-1.2.5}/docs/source/conf.py +0 -0
  14. {diffct-1.2.4 → diffct-1.2.5}/docs/source/examples.rst +0 -0
  15. {diffct-1.2.4 → diffct-1.2.5}/docs/source/fbp_fan_example.rst +0 -0
  16. {diffct-1.2.4 → diffct-1.2.5}/docs/source/fbp_parallel_example.rst +0 -0
  17. {diffct-1.2.4 → diffct-1.2.5}/docs/source/fdk_cone_example.rst +0 -0
  18. {diffct-1.2.4 → diffct-1.2.5}/docs/source/getting_started.rst +0 -0
  19. {diffct-1.2.4 → diffct-1.2.5}/docs/source/index.rst +0 -0
  20. {diffct-1.2.4 → diffct-1.2.5}/docs/source/iterative_reco_cone_example.rst +0 -0
  21. {diffct-1.2.4 → diffct-1.2.5}/docs/source/iterative_reco_fan_example.rst +0 -0
  22. {diffct-1.2.4 → diffct-1.2.5}/docs/source/iterative_reco_parallel_example.rst +0 -0
  23. {diffct-1.2.4 → diffct-1.2.5}/examples/fbp_fan.py +0 -0
  24. {diffct-1.2.4 → diffct-1.2.5}/examples/fbp_parallel.py +0 -0
  25. {diffct-1.2.4 → diffct-1.2.5}/examples/fdk_cone.py +0 -0
  26. {diffct-1.2.4 → diffct-1.2.5}/examples/iterative_reco_cone.py +0 -0
  27. {diffct-1.2.4 → diffct-1.2.5}/examples/iterative_reco_fan.py +0 -0
  28. {diffct-1.2.4 → diffct-1.2.5}/examples/iterative_reco_parallel.py +0 -0
  29. {diffct-1.2.4 → diffct-1.2.5}/requirements.txt +0 -0
@@ -0,0 +1,20 @@
1
+ name: Create Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ name: Create Release
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ - name: Create Release
18
+ uses: softprops/action-gh-release@v2
19
+ with:
20
+ generate_release_notes: true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffct
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: A CUDA-based library for computed tomography (CT) projection and reconstruction with differentiable operators
5
5
  Project-URL: Homepage, https://github.com/sypsyp97/diffct
6
6
  Author-email: Yipeng Sun <yipeng.sun@fau.de>
@@ -19,6 +19,8 @@ _TPB_3D = (8, 8, 8)
19
19
  # Trades numerical precision for performance in ray-tracing calculations
20
20
  # Safe for CT reconstruction where slight precision loss is acceptable for speed gains
21
21
  _FASTMATH_DECORATOR = cuda.jit(cache=True, fastmath=True)
22
+ # Disable fastmath for backward kernels to ensure gradient correctness
23
+ _NON_FASTMATH_DECORATOR = cuda.jit(cache=True, fastmath=False)
22
24
  _INF = _DTYPE(np.inf)
23
25
  _EPSILON = _DTYPE(1e-6)
24
26
  # === Device Management Utilities ===
@@ -106,33 +108,6 @@ class TorchCUDABridge:
106
108
  raise ValueError("Tensor must be on CUDA device")
107
109
  return cuda.as_cuda_array(tensor.detach())
108
110
 
109
- @staticmethod
110
- def cuda_array_to_tensor(cuda_array, tensor_template):
111
- """Convert a Numba CUDA array to a PyTorch tensor.
112
-
113
- Wrap a Numba CUDA DeviceNDArray as a PyTorch tensor with matching device
114
- and dtype from a template tensor, sharing underlying memory.
115
-
116
- Parameters
117
- ----------
118
- cuda_array : numba.cuda.cudadrv.devicearray.DeviceNDArray
119
- Numba CUDA array to wrap.
120
- tensor_template : torch.Tensor
121
- Template tensor specifying device and dtype.
122
-
123
- Returns
124
- -------
125
- torch.Tensor
126
- PyTorch tensor sharing data with the CUDA array on the template's
127
- device and dtype.
128
-
129
- Examples
130
- --------
131
- >>> arr = cuda.device_array((10,), dtype=np.float32)
132
- >>> t = torch.zeros(10, device='cuda')
133
- >>> new_t = TorchCUDABridge.cuda_array_to_tensor(arr, t)
134
- """
135
- return torch.as_tensor(cuda_array, device=tensor_template.device, dtype=tensor_template.dtype)
136
111
 
137
112
  # === GPU-aware Trigonometric Table Generation ===
138
113
  def _trig_tables(angles, dtype=_DTYPE, device=None):
@@ -501,7 +476,7 @@ def _parallel_2d_forward_kernel(
501
476
 
502
477
  d_sino[iang, idet] = accum
503
478
 
504
- @_FASTMATH_DECORATOR
479
+ @_NON_FASTMATH_DECORATOR
505
480
  def _parallel_2d_backward_kernel(
506
481
  d_sino, n_ang, n_det,
507
482
  d_image, Nx, Ny,
@@ -781,7 +756,7 @@ def _fan_2d_forward_kernel(
781
756
 
782
757
  d_sino[iang, idet] = accum
783
758
 
784
- @_FASTMATH_DECORATOR
759
+ @_NON_FASTMATH_DECORATOR
785
760
  def _fan_2d_backward_kernel(
786
761
  d_sino, n_ang, n_det,
787
762
  d_image, Nx, Ny,
@@ -1131,7 +1106,7 @@ def _cone_3d_forward_kernel(
1131
1106
 
1132
1107
  d_sino[iview, iu, iv] = accum
1133
1108
 
1134
- @_FASTMATH_DECORATOR
1109
+ @_NON_FASTMATH_DECORATOR
1135
1110
  def _cone_3d_backward_kernel(
1136
1111
  d_sino, n_views, n_u, n_v,
1137
1112
  d_vol, Nx, Ny, Nz,
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "diffct"
7
- version = "1.2.4"
7
+ version = "1.2.5"
8
8
  description = "A CUDA-based library for computed tomography (CT) projection and reconstruction with differentiable operators"
9
9
  readme = "README.md"
10
10
  authors = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes