Conversation
Drop legacy version checks for fftshift/ifftshift and simplify fallback paths. MONAI's minimum PyTorch version is now 2.4.1, making this code obsolete. Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
Remove notes about fallback behavior from fft_utils_t.py following removal of PyTorch 1.8.0 compatibility code. Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
📝 WalkthroughWalkthroughRemoves embedded version check logic and related documentation from FFT utility functions. In Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
monai/transforms/utils.py (1)
1886-1908:⚠️ Potential issue | 🟡 MinorRemove unused parameter
n_dims.The
n_dimsparameter is not referenced in the function body and is not documented in the Args section. Callers pass values to thespatial_dimsparameter (second positional argument), leavingn_dimsunused throughout.Proposed fix
`@staticmethod` def inv_shift_fourier( - k: NdarrayOrTensor, spatial_dims: int, n_dims: int | None = None, as_contiguous: bool = False + k: NdarrayOrTensor, spatial_dims: int, as_contiguous: bool = False ) -> NdarrayOrTensor:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@monai/transforms/utils.py` around lines 1886 - 1908, The function inv_shift_fourier has an unused parameter n_dims; remove n_dims from the function signature and any internal references, update the docstring Args to drop the n_dims entry, and adjust any call sites that currently pass a third argument to pass only spatial_dims (or use keyword as_contiguous) so callers match the new signature; keep the logic using spatial_dims and as_contiguous unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@monai/transforms/utils.py`:
- Around line 1886-1908: The function inv_shift_fourier has an unused parameter
n_dims; remove n_dims from the function signature and any internal references,
update the docstring Args to drop the n_dims entry, and adjust any call sites
that currently pass a third argument to pass only spatial_dims (or use keyword
as_contiguous) so callers match the new signature; keep the logic using
spatial_dims and as_contiguous unchanged.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
monai/networks/blocks/fft_utils_t.pymonai/transforms/utils.py
💤 Files with no reviewable changes (1)
- monai/networks/blocks/fft_utils_t.py
|
I guess the coderabbit comment is preexisting and not in the scope of this PR? I can make that change separately after the decision on this change? |
It appears so, yes. It should be removed with a deprecation warning which can be done as a separate PR, though it seems to be low priority. |
Sounds good. Thank you very much. Ill make one then after this is merged. I haven't looked into it to really verify what all that bit of code is touching. |
Remove legacy PyTorch 1.8.0 compatibility code from FFT utilities. MONAI now requires PyTorch ≥ 2.4.1, so the version checks and NumPy fallbacks are no longer needed.
Types of changes