Commit cab85c9
perf: batched transform_mapping_matrix in TransformerNUFFT (single nufft2d2 call)
The previous implementation looped over each source-pixel column in
Python, scattering each into a (N_y, N_x) image and calling _forward_native
separately. Under jax.jit this fully unrolled into n_src distinct nufft2d2
invocations in one trace, ballooning the JIT graph for pixelization-heavy
fits — most visibly the rectangular_dspl JAX-likelihood script, where
two source planes with mesh_shape=(30,30) gave 1800 inlined NUFFTs and
caused 11+ minute slow-compile warnings (and OOM on 16 GB hosts).
The replacement scatters all columns into a single (n_src, N_y, N_x)
batched array and calls nufft2d2 once with batched f. nufftax natively
supports the batched form. Numerical results unchanged (existing
test_transformer.py passes); the JIT graph drops from O(n_src) NUFFTs
to a single batched NUFFT call.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f126249 commit cab85c9
1 file changed
Lines changed: 34 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
682 | | - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
683 | 687 | | |
684 | | - | |
685 | 688 | | |
686 | | - | |
687 | | - | |
| 689 | + | |
| 690 | + | |
688 | 691 | | |
689 | 692 | | |
690 | 693 | | |
691 | 694 | | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
0 commit comments