docs: add missing docstrings, Raises sections, and fix Args in networ…#8850
docs: add missing docstrings, Raises sections, and fix Args in networ…#8850chhayankjain wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (5)
📝 WalkthroughWalkthroughThis PR updates docstrings across multiple MONAI network block classes, adding explicit Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
d9cfd74 to
a1bf6f1
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@monai/networks/blocks/downsample.py`:
- Around line 133-134: Update the docstring ValueError clause for the downsample
block to precisely match the implemented check: state that the error is raised
only when mode is "maxpool" or "avgpool", pre_conv == "default", out_channels !=
in_channels, and in_channels is not provided; locate the exception description
in the downsample module's docstring (the section documenting raised exceptions
for parameters mode/pre_conv/in_channels/out_channels) and change the sentence
to include the additional condition out_channels != in_channels so the docs
mirror the actual code path.
In `@monai/networks/blocks/localnet_block.py`:
- Around line 302-303: The docstring for the initializer parameter in
LocalNetBlock (parameter name: initializer) claims the default is
"kaiming_uniform" but the implementation calls nn.init.kaiming_normal_; make
them consistent by either changing the docstring default to "kaiming_normal"
(and document accepted values accordingly) or changing the implementation to use
nn.init.kaiming_uniform_ when initializer=="kaiming_uniform"; update the
initializer handling logic in the LocalNetBlock __init__ (or the function that
performs weight initialization) and the docstring so the parameter name, allowed
string values, and applied nn.init.* call match exactly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 07796a91-596c-4fbc-97ad-52cf3abecb3d
📒 Files selected for processing (6)
monai/networks/blocks/crossattention.pymonai/networks/blocks/downsample.pymonai/networks/blocks/localnet_block.pymonai/networks/blocks/patchembedding.pymonai/networks/blocks/selfattention.pymonai/networks/blocks/upsample.py
…ks/blocks Signed-off-by: chhayankjain <chhayank44@gmail.com>
a1bf6f1 to
a66d670
Compare
Description
Fix several docstring issues across network blocks in
monai/networks/blocks/:localnet_block.py: add class and__init__docstrings withArgsandRaisessections toResidualBlockandLocalNetResidualBlock; fix broken indentation and incorrect parameter name (kernel_initializer→initializer) inLocalNetFeatureExtractorBlockselfattention.py: addRaisessection toSABlock.__init__crossattention.py: addRaisessection toCrossAttentionBlock.__init__patchembedding.py: addRaisessection toPatchEmbeddingBlock.__init__upsample.py: addRaisessection toUpSample.__init__downsample.py: addRaisessections toDownSample.__init__andSubpixelDownsample.__init__No functional changes.
Types of changes