Skip to content

docs: add missing loss entries to losses.rst - #9317

Open
sheetalsureshunny wants to merge 2 commits into
Project-MONAI:devfrom
sheetalsureshunny:9272-losses-api-docs
Open

sheetalsureshunny wants to merge 2 commits into
Project-MONAI:devfrom
sheetalsureshunny:9272-losses-api-docs

Conversation

@sheetalsureshunny

@sheetalsureshunny sheetalsureshunny commented Nov 23, 2026 •

Copy link
Copy Markdown

Fixes #9272.

Description

Adds Sphinx autoclass entries for the public monai.losses members that had no API documentation:

  • Classes: AUCMLoss, AsymmetricUnifiedFocalLoss, BoxGIoULoss, LogHausdorffDTLoss (the four listed in the issue)
  • Aliases, which are also exported publicly and were undocumented: dice_ce, dice_focal, generalized_dice_focal (nested under their classes' headings, matching the existing dice / generalized_dice style), and giou under BoxGIoULoss

LogHausdorffDTLoss is placed inside the existing HausdorffDTLoss heading since both live in hausdorff_loss.py. AsymmetricUnifiedFocalLoss joins Segmentation Losses. AUCMLoss (AUROC/classification) and BoxGIoULoss (bounding-box regression) get new Classification Losses and Detection Losses sections rather than being filed under segmentation.

Also tidies the page structure:

  • a task-based summary table at the top linking to each section
  • a short description under every section heading
  • automodule/currentmodule moved to page level (they were nested inside the Segmentation section)

All 42 names exported from monai.losses are now covered by the page.

Note: the issue author expressed interest in working on this ~2 weeks ago; no PR was opened, so submitting this — happy to close or coordinate if they already have work in progress.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Add autoclass entries for the public losses missing from the API
documentation: AUCMLoss, AsymmetricUnifiedFocalLoss, BoxGIoULoss and
LogHausdorffDTLoss, plus the documented-but-undocumented aliases
dice_ce, dice_focal, generalized_dice_focal and giou. BoxGIoULoss and
AUCMLoss are placed under new Detection and Classification sections
respectively.

Assisted-by: Devin <devin@cognition.ai>
Signed-off-by: Sheetal Suresh Unny <227441477+sheetalsureshunny@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 20:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review.

Walkthrough

The loss reference adds task-based navigation and descriptions. It adds API entries for dice_ce, dice_focal, generalized_dice_focal, LogHausdorffDTLoss, AsymmetricUnifiedFocalLoss, AUCMLoss, BoxGIoULoss, and giou. It also adds descriptions and anchors for registration, reconstruction, and wrapper loss sections.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: Minimal · up to fd148

This documentation-only change adds the missing loss classes and aliases to the losses reference page, grouped by task. It has no runtime impact and is low risk to merge.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Out of Scope Changes check Inconclusive The requested change is limited to autoclass entries for #9272. The head losses.rst also contains changes the PR description does not mention: a new list-table index grouping losses by task, new task … Provide the base-to-head diff for docs/source/losses.rst. Confirm which index, description, anchor, and removed-line changes were already present at the merge base. If the index table, task descriptions, or anchors were added by this PR and…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title "docs: add missing loss entries to losses.rst" matches the changeset, which adds autoclass entries for undocumented monai.losses classes and aliases to docs/source/losses.rst. It is specific…
Linked Issues check Passed [#9272] Requires autoclass entries for LogHausdorffDTLoss, AsymmetricUnifiedFocalLoss, AUCMLoss, and BoxGIoULoss. Head docs/source/losses.rst contains all four: LogHausdorffDTLoss under HausdorffDTLos…
Description check Passed The description follows the template's required structure. It names the linked issue (Fixes #9272), gives a clear Description covering the added autoclass entries, aliases, section reorganization, and…
Full details: Title check

Explanation

The title "docs: add missing loss entries to losses.rst" matches the changeset, which adds autoclass entries for undocumented monai.losses classes and aliases to docs/source/losses.rst. It is specific and concise.

Full details: Linked Issues check

Explanation

[#9272] Requires autoclass entries for LogHausdorffDTLoss, AsymmetricUnifiedFocalLoss, AUCMLoss, and BoxGIoULoss. Head docs/source/losses.rst contains all four: LogHausdorffDTLoss under HausdorffDTLoss, AsymmetricUnifiedFocalLoss under Segmentation Losses, AUCMLoss under Classification Losses, BoxGIoULoss under Detection Losses. Entries use the same autoclass and :members: form as existing entries. Aliases dice_ce, dice_focal, generalized_dice_focal, and giou also have entries. Coding requirement is documentation-only; no automated test applies. Limit: the base-to-head text diff was unavailable, so the changed-line count (+94/-2 in the summary) could not be verified. Requirement status rests on head file content.

Full details: Description check

Explanation

The description follows the template's required structure. It names the linked issue (Fixes #9272), gives a clear Description covering the added autoclass entries, aliases, section reorganization, and the reason for placement decisions. It also includes the Types of changes checklist with one box marked. The checklist is not fully updated, but the description is mostly complete. It does not report that make html or the test commands were run, and it leaves 'New tests added' unchecked. Those are reasonable for a docs-only change, but the docs build check is still unconfirmed.

Full details: Out of Scope Changes check

Explanation

The requested change is limited to autoclass entries for #9272. The head losses.rst also contains changes the PR description does not mention: a new list-table index grouping losses by task, new task description paragraphs for Segmentation, Registration, Reconstruction, and Loss Wrappers, new section anchors (.. _Segmentation:, .. _Classification:, etc.), and a reported net change of 2 removed lines. These changes are in the same file but are not required to add the four classes or aliases. The base-to-head diff was unavailable, so the base content of the removed lines and whether the Registration, Reconstruction, and Wrapper sections were pre-existing could not be verified. Relatedness of these additions to #9272 cannot be decided from the available evidence.

Resolution

Provide the base-to-head diff for docs/source/losses.rst. Confirm which index, description, anchor, and removed-line changes were already present at the merge base. If the index table, task descriptions, or anchors were added by this PR and are not needed for #9272, remove them or move them to a separate PR and update the PR description to match.

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 66eff21 and fd148e7.

Files selected for processing: 1

  • docs/source/losses.rst
Files skipped from review as they are similar to previous changes: 1

  • docs/source/losses.rst

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Move automodule/currentmodule to the page level and add a task-based
summary table linking to new per-category anchors, with a short
description under each section heading.

Assisted-by: Devin <devin@cognition.ai>
Signed-off-by: Sheetal Suresh Unny <227441477+sheetalsureshunny@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing loss classes in API documentation

2 participants