-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError with SpatialPad when input is MetaTensor and padding size is the same as tensor size #7323
Comments
Hi @virginiafdez, thanks for the reporting.
Thanks! |
This issue is related to how data is being collated by the data loader when putting list-based batches together with RandSpatialCropSamplesd. We're still trying to narrow down what's going on but it's more than just the transform that's raising the error. |
The following replicates the issue:
After cropping the samples and putting these transform into the loader, there seems to be a problem with len(orig_affine) in TraceableTransform.track_transform_meta. @atbenmurray in case you want to have a look / help! |
One thing to note in the above code is that |
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Just like Eric said, the issue is due to that the post_transform is applied on a batch of data.
Also create a patch to add more information when raising exception. |
closing as merged @KumoLiu @virginiafdez |
…tiplication (#7326) Fixes #7323 ### Description Give more useful exception when batch is considered during matrix multiplication. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
…tiplication (Project-MONAI#7326) Fixes Project-MONAI#7323 ### Description Give more useful exception when batch is considered during matrix multiplication. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Signed-off-by: Mark Graham <markgraham539@gmail.com>
…tiplication (Project-MONAI#7326) Fixes Project-MONAI#7323 ### Description Give more useful exception when batch is considered during matrix multiplication. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Signed-off-by: Juan Pablo de la Cruz Gutiérrez <juampatronics@gmail.com>
…tiplication (Project-MONAI#7326) Fixes Project-MONAI#7323 ### Description Give more useful exception when batch is considered during matrix multiplication. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] 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. --------- Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Signed-off-by: Yu0610 <612410030@alum.ccu.edu.tw>
Hello,
When dealing with a MetaTensor (track_meta = True) that has the same shape you are padding to with SpatialPad, the following error occurs:
This doesn't happen if input is a tensor, or if I set track_meta to False with a transform prior to padding.
To Reproduce
Expected behavior
If this specific scenario, where the shape should be different, is not supported in case of MetaTensors, the error should be clearer. In any other scenario (dealing with normal tensors) the shape is left the same and no error occurs.
Environment
python 3.9
monai 1.3.0
pytorch 2.1.0, 1.13.1 (both have the same problem)
The text was updated successfully, but these errors were encountered: