docs: fix docstring parameter name, add missing Args and Raises secti…#8849
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 (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR updates docstrings in five MONAI loss modules: monai/losses/barlow_twins.py, ds_loss.py, multi_scale.py, nacl_loss.py, and perceptual.py. Changes correct a parameter name in BarlowTwinsLoss and expand docstrings to document arguments, supported values, and raised exceptions (including DeepSupervisionLoss.forward, MultiScaleLoss.init, NACLLoss.init, and PerceptualLoss). No runtime behavior, control flow, or public API signatures were changed. Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 |
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/losses/ds_loss.py`:
- Around line 72-79: The forward method's docstring in monai/losses/ds_loss.py
is missing a Returns section; update the docstring for the forward function
(method name: forward, class: DSLoss/DeeplySupervisedLoss if present) to include
a Returns section that states it returns a torch.Tensor (describe shape/meaning,
e.g., scalar loss tensor or per-sample loss tensor) and any dtype/device
expectations, and keep the existing Args/Raises content unchanged so readers
know what the function returns.
In `@monai/losses/multi_scale.py`:
- Around line 64-66: The docstring for the function in
monai/losses/multi_scale.py documents a ValueError only for invalid ``kernel``
but omits that invalid ``reduction`` values also raise ValueError; update the
Raises section to list ValueError for unsupported ``reduction`` values (e.g.,
describe when ``reduction`` is not one of the accepted options) so users know
both error conditions raised by the function that uses the ``reduction``
parameter.
🪄 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: e8f36a6b-375a-47a2-9839-f7a39b7703c1
📒 Files selected for processing (5)
monai/losses/barlow_twins.pymonai/losses/ds_loss.pymonai/losses/multi_scale.pymonai/losses/nacl_loss.pymonai/losses/perceptual.py
23266b7 to
e90190e
Compare
|
@virginiafdez @KumoLiu @ericspod @Nic-Ma |
ericspod
left a comment
There was a problem hiding this comment.
Hi @chhayankjain looks good to me, thanks!
…ons in losses Signed-off-by: chhayankjain <chhayank44@gmail.com>
Head branch was pushed to by a user without write access
c2115f7 to
47d58a3
Compare
Description
Fix several docstring issues across loss functions in
monai/losses/:barlow_twins.py: fix parameter name typo (lamb→lambd) in Args sectionnacl_loss.py: add missingkernel_opsarg, updatedistance_type/alphawith defaults, addRaisessectionmulti_scale.py: add missingreductionarg, addRaisessectionds_loss.py: addforwarddocstring with Args andRaisessectionperceptual.py: addRaisessection to class docstringNo functional changes.
Types of changes