Skip to content

Conversation

@aman0311x
Copy link

@aman0311x aman0311x commented Dec 22, 2025

Fixes # .

Description

This pull request fixes incorrect formatting and clarifies the documentation
for the network_type argument in PerceptualLoss.

The docstring now correctly reflects the supported network options
and matches the actual implementation.

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.

No functional behavior is changed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

Walkthrough

The enum class in monai/losses/perceptual.py was renamed from PercetualNetworkType to PerceptualNetworkType. All references in that file — including the PerceptualLoss constructor default, validation checks, error messages, and docstring examples — were updated to use PerceptualNetworkType. No runtime logic was changed aside from the identifier rename.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Confirm all references/imports in this file use PerceptualNetworkType.
  • Search the repository for any remaining uses of PercetualNetworkType (public API, docs, type hints).
  • Verify exported names/exports if the enum is part of the public API.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title directly matches the main change: fixing docstring formatting for the network_type parameter in PerceptualLoss.
Description check ✅ Passed PR description follows the template structure with completed sections, though the issue number reference is incomplete.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
monai/losses/perceptual.py (1)

75-75: Update type annotation to match accepted types.

Type annotation specifies str but should be str | PercetualNetworkType to match the docstring and actual usage.

🔎 Proposed fix
-        network_type: str = PercetualNetworkType.alex,
+        network_type: str | PercetualNetworkType = PercetualNetworkType.alex,
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 15fd428 and 7ce29a1.

📒 Files selected for processing (1)
  • monai/losses/perceptual.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

Review the Python code for quality and correctness. Ensure variable names adhere to PEP8 style guides, are sensible and informative in regards to their function, though permitting simple names for loop and comprehension variables. Ensure routine names are meaningful in regards to their function and use verbs, adjectives, and nouns in a semantically appropriate way. Docstrings should be present for all definition which describe each variable, return value, and raised exception in the appropriate section of the Google-style of docstrings. Examine code for logical error or inconsistencies, and suggest what may be changed to addressed these. Suggest any enhancements for code improving efficiency, maintainability, comprehensibility, and correctness. Ensure new or modified definitions will be covered by existing or new unit tests.

Files:

  • monai/losses/perceptual.py
🔇 Additional comments (2)
monai/losses/perceptual.py (2)

52-56: Docstring update is accurate but type annotation doesn't match.

The docstring correctly documents that network_type accepts both str and PercetualNetworkType, but the type annotation on line 75 only specifies str.


98-102: No issues found. StrEnum members inherit from str, so .lower() works on enum inputs and comparison against list(PercetualNetworkType) succeeds for both string and enum inputs. Logic is correct as written.

…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit.

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit.

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce29a1 and e2d0a02.

📒 Files selected for processing (1)
  • monai/losses/perceptual.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

Review the Python code for quality and correctness. Ensure variable names adhere to PEP8 style guides, are sensible and informative in regards to their function, though permitting simple names for loop and comprehension variables. Ensure routine names are meaningful in regards to their function and use verbs, adjectives, and nouns in a semantically appropriate way. Docstrings should be present for all definition which describe each variable, return value, and raised exception in the appropriate section of the Google-style of docstrings. Examine code for logical error or inconsistencies, and suggest what may be changed to addressed these. Suggest any enhancements for code improving efficiency, maintainability, comprehensibility, and correctness. Ensure new or modified definitions will be covered by existing or new unit tests.

Files:

  • monai/losses/perceptual.py
🧬 Code graph analysis (1)
monai/losses/perceptual.py (1)
monai/utils/enums.py (1)
  • StrEnum (68-90)
🔇 Additional comments (1)
monai/losses/perceptual.py (1)

52-60: LGTM: Improved docstring clarity.

The reformatted list of valid network_type values is clearer than the previous inline notation.

…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit: 7ce29a1

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit: cc0c951

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit: 7ce29a1

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit: cc0c951

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
…il.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to this commit: 3e92d74

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
@aman0311x
Copy link
Author

Hi @virginiafdez,

The spelling/enum issue in PerceptualLoss has been fixed (PercetualNetworkType → PerceptualNetworkType), and all references/docstrings have been updated accordingly.

Additionally, all missing DCO sign-offs have been added via remediation commits. Everything should now be in order for review.

Signed-off-by: Mohammad Amanour Rahman <amanourrahman@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3e92d74 and 8be3faa.

📒 Files selected for processing (1)
  • e --abort

e --abort Outdated
Comment on lines 1 to 114
bc38c962 (HEAD -> dev) Fix PerceptualLoss enum references and docstrings
be2869df Fix network_type docstring formatting in PerceptualLoss
ccea8930 (origin/dev, origin/HEAD) DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
0c667a99 DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
ea64afaf DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
3e92d74e Fix PerceptualLoss enum references and docstrings
84e7d704 DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
eeef1729 DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
cc0c951f Fix PerceptualLoss enum references and docstrings
96ea131f DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
e2d0a027 DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>
7ce29a1e Fix network_type docstring formatting in PerceptualLoss
15fd428c Bump actions/checkout from 4 to 6 (#8649)
e5417c86 Bump al-cheb/configure-pagefile-action from 1.4 to 1.5 (#8648)
c1d02cf1 Bump peter-evans/slash-command-dispatch from 4.0.0 to 5.0.0 (#8650)
e2677053 Added an optional_import check for onnxruntime and applied the @unitt… (#8641)
04a89ee9 Generate heatmap transforms (#8579)
f493ecdd 8620 modulenotfounderror no module named onnxscript in test py3x 311 pipeline (#8638)
9a456274 Fix #8350: Clarify LocalNormalizedCrossCorrelationLoss docstring (#8639)
865b0e70 Update documentation links (#8637)
c968907c Fix #8599: Add track_meta and weights_only arguments to PersistentDataset for MetaTensor support. (#8628)
806c0e84 Fix index using tuple for image cropping operation (#8633)
23c271ea feat: add activation checkpointing to unet (#8554)
16e469c8 Correct H&E stain ordering heuristic in ExtractHEStains (#8551)
a8a7e575 timestep scheduling with np.linspace (#8623)
f315bcb0 8620 ModuleNotFoundError: No module named \'onnxscript\' in test-py3x (3.11) pipeline (#8621)
e72145ce Fix box_iou returning 0 for floating-point results less than 1. #8369 (#8553)
579cec52 added ReduceTrait and FlattenSequence (#8531)
d260b785 Bump github/codeql-action from 3 to 4 (#8616)
b10410ce Bump actions/upload-artifact from 4 to 5 (#8615)
69444c13 Bump actions/download-artifact from 5 to 6 (#8614)
d9cfa3e6 Bump peter-evans/create-or-update-comment from 4 to 5 (#8612)
09ace633 Include more-itertools in build env (#8611)
42a99477 8564 fourier positional encoding (#8570)
69f3dd26 Bump actions/setup-python from 5 to 6 (#8589)
c4a1acc8 Bump actions/checkout from 4 to 5 (#8588)
8a2efcb0 Bump actions/download-artifact from 4 to 5 (#8590)
53382d83 Update citation for 1.5.1 (#8582)
9c6d819f Release 1.5.1 Updates (#8575)
9122739e Removing instantiation in forward (#8580)
cf5790db Fix gdown fails (#8576)
cf5505a5 Diffusion Model Encoder has an output layer set in forward method and this leads to problems (#8578)
6327a861 Transformers version (#8574)
946cfdff Path traversal issue security fix (#8568)
948fbb70 Torch and Pickle Safe Load Fixes (#8566)
401ea4a0 Fix hardcoded input dim in DiffusionModelEncoder (#8514)
fd13c1b5 Create SECURITY.md (#8546)
725c8dea Torchvision pretrain fix (#8563)
b5bc69d0 Classifier free guidance unconditioned value (#8562)
0968da20 Improve Orientation transform to use the "space" (LPS vs RAS) of a metatensor by default (#8473)
d4ba52e3 Fix build failure by pinning pyamg to versions below 5.3.0 (#8548)
cb200af0 Tests Cleanup (#8535)
1e6c6615 8525 improve documentation on the datalist format (#8539)
cf869814 fix: HistogramNormalized doc (#8543)
cafc1feb Pytorch 2.8 Support (#8530)
b92b2ce8 Add support for optional conditioning in PatchInferer, SliceInferer, and SlidingWindowInferer (#8400)
2a12c4b4 Add input validation to ImageStats class (#8501)
ede6ace8 Throw exception on invalid images in retinanet detector (#8515)
1dc0e68c 8185 test refactor 2 (#8405)
503b4ede fix bug in maisi vae (#8517)
8ee3f89b Updates for Pytorch 2.7 (#8429)
def42221 Adding .coderabbit.yaml File (#8513)
e0be5d27 Update README badges to add research paper citations number (#8494)
e499362b add kwargs in array and functional file (#8508)
4b69748a ci: add custom timeout to ci job in order to save resources (#8504)
d388d1c6 Update citation (#8484)
3d6021a6 Fix: ZarrAvgMerger ValueError with zarr_format 3 (#8477)
d38c93f9 Removed or Replaced Broken URLs (#8483)
e5c512ff Fix integration test in 24.10 (#8480)
423ea748 Fixing URLs in README.md (#8481)
dfe6fc77 Changelog For 1.5 (#8474)
c3a317d2 Adding CODEOWNERS (#8457)
c3a3397d Remove unused test cases in bundle load (#8463)
2d416557 Classifier free guidance (#8460)
f85135b0 Remove deprecated `net_name` in test file (#8461)
d4b4bff9 Adding Support Policy + Doc Updates (#8458)
222d5094 Migrate to modern Python Logger API (#8449)
bf6bc1fd Enable code coverage comments on PRs in codecov configuration (#8402)
707b2305 Remove deprecated `return_state_dict ` in bundle `load` (#8454)
03a0d851 Fix AutoencoderKL docstrings. (#8445)
daf9f054 Update default overlap value in occlusion_sensitivity to 0.6 (#8446)
f97a0e9b Remove deprecated functionality for v1.5 (#8430)
4305bb81 :bug: fix cosine noise scheduler (#8427)
0d19a72f Temporarily Restrict setuptools Version to 79.0.1 (#8441)
b58e883c selfattention block: Remove the fc linear layer if it is not used (#8325)
f27517b8 Inverse Threading Fix (#8418)
8f3d8e87 Update get latest bundle version function (#8420)
eadffd24 Fix OptionalImportError: required package `openslide` is not installed (#8419)
9586071c Add Skip test in TestTranschex (#8416)
6c8de354 8394 Update bundle download API (#8403)
83dcd35c Fix: correctly apply fftshift to real-valued data inputs (#8407)
90ead4bf 8328 nnunet bundle integration (#8329)
4986d7ff Auto3DSeg algo_template hash update (#8406)
bfcb318b Restormer Implementation (#8312)
8aef9a98 Update Dice Metric Docs (#8388)
5c5ca232 Auto3DSeg algo_template hash update (#8397)
0f5da113 Auto3DSeg algo_template hash update (#8393)
41d6c9c2 8201 Fix DataFrame subsets indexing in CSVDataset() (#8351)
34f37973 add prediction type for rflow scheduler (#8386)
90de55b1 Add rectified flow noise scheduler for accelerated diffusion model (#8374)
7c26e5af Enable Pytorch 2.6 (#8309)
1983f277 Auto3DSeg algo_template hash update (#8378)
2e391c82 Bump torch minimum to mitigate CVE-2024-31580 & CVE-2024-31583 and enable numpy 2 compatibility (#8368)
a09c1f08 Update monaihosting download method (#8364)
ab075234 Modify ControlNet inferer so that it takes in context when the diffus… (#8360)
a7905909 8354 fix path at test onnx trt export (#8361)
d98f3481 Solves path problem in test_bundle_trt_export.py (#8357)
af54a17b Add Average Precision to metrics (#8089)
b0ed2534 Fix CommonKeys docstring (#8342)
fb8c5bf7 Removed outdated `torch` version checks from transform functions (#8359)
960c59b4 Fix `packaging` imports in version comparison logic (#8347)
0a85eed2 Inferer modification - save_intermediates clashes with latent shape adjustment in latent diffusion inferers (#8343)
44add8d1 Bump min torch to 1.13.1 to mitigate CVE-2022-45907 unsafe usage of eval (#8296)
e538f7fd Recursive Item Mapping for Nested Lists in Compose (#8187)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Wrong file provided - cannot review git log output.

The file appears to be a git log dump rather than source code. The filename "e --abort" suggests a malformed command. The PR objectives indicate changes to monai/losses/perceptual.py (enum rename from PercetualNetworkType to PerceptualNetworkType), but that file was not provided for review.

Please provide the actual source file with code changes.

🤖 Prompt for AI Agents
In e --abort around lines 1-114 the uploaded file is a git log dump (wrong file)
instead of the intended source; replace this with the actual modified source
file monai/losses/perceptual.py containing the PR changes, rename the misspelled
enum PercetualNetworkType to PerceptualNetworkType (update the enum definition,
all references, imports, and type hints), fix related docstrings and any
occurrences of the old name, run unit tests and linters, and amend the commit/PR
to include the corrected file so reviewers can verify the change.

DCO Remediation Commit for Mohammad Amanour Rahman <amanourrahman@gmail.com>

I, Mohammad Amanour Rahman <amanourrahman@gmail.com>, hereby add my Signed-off-by to the previous commits.
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.

1 participant