Commit e815c23
committed
Fix RandGridDistortiond crash when transform is skipped
When _do_transform is False, convert_to_tensor was called on the
entire data dict, which fails when non-tensor values (e.g. ints,
strings) are present — causing "AttributeError: 'int' object has
no attribute 'numel'" in the DataLoader collate function.
Convert only the keyed tensor items instead, consistent with how
other dict transforms handle the no-transform case.
Fixes #86041 parent 5b71547 commit e815c23
File tree
2 files changed
+15
-2
lines changed- monai/transforms/spatial
- tests/transforms
2 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2305 | 2305 | | |
2306 | 2306 | | |
2307 | 2307 | | |
2308 | | - | |
2309 | | - | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
2310 | 2311 | | |
2311 | 2312 | | |
2312 | 2313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
89 | 101 | | |
90 | 102 | | |
0 commit comments