Commit c212f47
committed
Fix three malformed error messages
Adjacent string literals concatenate in Python, and in two places the
join produces text the author clearly did not intend:
monai/networks/utils.py:443 pixelunshuffle()
"...divisible by factor 2. , spatial shape is: [7, 8]"
The second literal opens with ", " while the first already closed
with ". ", so the rendered message carries a stray ". ,".
monai/inferers/inferer.py:1776 LatentDiffusionInferer.__init__()
"...autoencoder_latent_shape must be Noneand vice versa."
No trailing space on the first literal, so two words run together.
The third is a plain typo in the same family, a missing comma in a list
of valid options, appearing in both the raised message and the docstring
that documents it:
monai/metrics/utils.py:104,144 do_metric_reduction()
'[..., "mean_channel", "sum_channel" "none"].'
Every sibling message in monai/losses/ writes this list fully
comma-separated.
All three are user-visible text only; no behaviour changes.
Adds a regression test for the pixelunshuffle() path, which had no
coverage of its ValueError at all. The test fails against the
unmodified source with:
AssertionError: "divisible by factor 2, spatial shape is: \[7, 8\]"
does not match "All spatial dimensions must be divisible by factor
2. , spatial shape is: [7, 8]"
Verified locally: tests/networks/utils (57 tests), tests/metrics (477),
tests.inferers.test_latent_diffusion_inferer (45) and
tests.inferers.test_controlnet_inferers (58) all pass, as do
runtests.sh --codeformat and pre-commit run --all-files.
tests/metrics has one pre-existing failure, test_compute_fid_metric,
from a scipy sqrtm(disp=...) signature change; it fails identically on
unmodified dev and is unrelated to this change.
Signed-off-by: Hans Johnson <hans-johnson@uiowa.edu>1 parent c1240a2 commit c212f47
4 files changed
Lines changed: 9 additions & 4 deletions
File tree
- monai
- inferers
- metrics
- networks
- tests/networks/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1773 | 1773 | | |
1774 | 1774 | | |
1775 | 1775 | | |
1776 | | - | |
| 1776 | + | |
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
| 443 | + | |
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
0 commit comments