-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add kwargs in array and functional file #8508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
""" WalkthroughThe changes update the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ZoomTransform
participant ZoomFunction
participant PadOrCrop
User->>ZoomTransform: __call__(img, ...)
ZoomTransform->>ZoomFunction: zoom(img, ..., **kwargs)
ZoomFunction->>PadOrCrop: ResizeWithPadOrCrop(..., **kwargs)
PadOrCrop-->>ZoomFunction: padded/cropped image
ZoomFunction-->>ZoomTransform: zoomed image
ZoomTransform-->>User: result
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
monai/transforms/spatial/functional.py (1)
414-414
: Consider updating the docstring to document the**kwargs
parameter.The function signature now accepts
**kwargs
which are forwarded toResizeWithPadOrCrop
. Consider adding documentation for this parameter to clarify what additional arguments are supported (e.g., padding-related arguments likepad_kwargs
).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
monai/transforms/spatial/array.py
(1 hunks)monai/transforms/spatial/functional.py
(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
monai/transforms/spatial/functional.py (1)
monai/transforms/croppad/array.py (1)
ResizeWithPadOrCrop
(1397-1502)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
- GitHub Check: quick-py3 (ubuntu-latest)
- GitHub Check: quick-py3 (windows-latest)
- GitHub Check: quick-py3 (macOS-latest)
- GitHub Check: packaging
- GitHub Check: flake8-py3 (mypy)
- GitHub Check: flake8-py3 (pytype)
- GitHub Check: flake8-py3 (codeformat)
- GitHub Check: build-docs
- GitHub Check: min-dep-py3 (3.9)
- GitHub Check: min-dep-pytorch (2.6.0)
- GitHub Check: min-dep-os (windows-latest)
- GitHub Check: min-dep-os (macOS-latest)
- GitHub Check: min-dep-py3 (3.11)
- GitHub Check: min-dep-py3 (3.12)
- GitHub Check: min-dep-pytorch (2.4.1)
- GitHub Check: min-dep-py3 (3.10)
- GitHub Check: min-dep-pytorch (2.5.1)
- GitHub Check: min-dep-os (ubuntu-latest)
🔇 Additional comments (3)
monai/transforms/spatial/array.py (1)
1111-1111
: LGTM! Clean implementation of kwargs forwarding.This change correctly implements the forwarding of additional keyword arguments from the
Zoom
transform constructor to the underlyingzoom
function. The implementation:
- Properly forwards
**self.kwargs
to enable passing extra parameters to ResizeWithPadOrCrop operations- Is already documented in the constructor docstring (line 1036-1037)
- Follows the established pattern used by other transforms in the codebase
- Resolves the issue mentioned in the PR objectives without introducing breaking changes
The placement as the final parameter in the function call is appropriate and maintains code readability.
monai/transforms/spatial/functional.py (2)
453-453
: LGTM! Correctly forwards kwargs in lazy evaluation path.The
**kwargs
are properly forwarded to theResizeWithPadOrCrop
constructor, which accepts additional padding-related arguments through its**pad_kwargs
parameter.
489-489
: LGTM! Correctly forwards kwargs in eager evaluation path.The
**kwargs
are properly forwarded to theResizeWithPadOrCrop
constructor, maintaining consistency with the lazy evaluation branch. This ensures that additional padding-related arguments are supported in both execution modes.
Signed-off-by: IamTingTing <6121smile@gmail.com>
a915108
to
943f225
Compare
/build |
Fixes #8492
Description
This PR adds support for
**kwargs
in theResizeWithPadOrCrop
transform to fix the issue where extra keyword arguments were ignored, causing errors in some workflows.Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.Summary by CodeRabbit
New Features
Refactor