Commit 0f5c5ec
authored
Remove dead and redundant code across monai/ (#8952)
### Description
Ran a code agent for dead code. Vetted them myself thereafter.
Removes dead statements, no-ops, and leftover commented-out code. No
runtime behavior changes.
| File | Dead/redundant code removed |
|---|---|
| `networks/nets/basic_unet.py` | Stray `print(f"BasicUNet features:
...")` debug call in constructor |
| `networks/nets/basic_unetplusplus.py` | Stray
`print(f"BasicUNetPlusPlus features: ...")` debug call in constructor |
| `networks/blocks/text_embedding.py` | Stray
`print(self.text_embedding)` debug call in `TextEncoder.forward` |
| `metrics/generalized_dice.py` | No-op self-assignment `y_pred_o =
y_pred_o` |
| `networks/layers/simplelayers.py` | No-op self-assignment `filter =
filter` in `MeanFilter` |
| `losses/nacl_loss.py` | Redundant `.abs_()` after `.pow_(2)` (operand
already non-negative) in L2 branch |
| `losses/image_dissimilarity.py` | Overwrite discarding the
`look_up_option`-validated `kernel_type` in
`GlobalMutualInformationLoss` |
| `data/ultrasound_confidence_map.py` | Dead `elif` branch with
discarded bare `s.shape[0]` expression |
| `inferers/merger.py` | Duplicated recomputation of `is_zarr_v3` in
`ZarrAvgMerger` |
| `utils/profiling.py` | Unused module-level `pandas` optional-import
(only consumer re-imports locally) |
| `apps/nnunet/utils.py` | Three blocks of commented-out code in
`create_new_dataset_json` |
| `apps/vista3d/transforms.py` | Commented-out `AsDiscrete` alternative
|
| `transforms/utils.py` | Commented-out `torch.zeros` alternative |
| `networks/layers/filtering.py` | Unreachable commented-out body after
`raise` in `PHLFilter.backward` |
### Types of changes
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
---------
Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>1 parent 683e1d1 commit 0f5c5ec
13 files changed
Lines changed: 2 additions & 27 deletions
File tree
- monai
- apps
- nnunet
- vista3d
- inferers
- losses
- metrics
- networks
- blocks
- layers
- nets
- transforms
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
| |||
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
164 | | - | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 167 | + | |
176 | 168 | | |
177 | 169 | | |
178 | 170 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | 312 | | |
316 | 313 | | |
317 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | 184 | | |
186 | 185 | | |
187 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 99 | | |
103 | 100 | | |
104 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
671 | 671 | | |
672 | 672 | | |
673 | 673 | | |
674 | | - | |
675 | 674 | | |
676 | 675 | | |
677 | 676 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
| |||
0 commit comments