Closed ClarkQTIM closed 1 year ago
Hi @ClarkQTIM, after a deep look at your code, I find that the comma following the upsample_kernel_size
parameter is the actual cause of the issue. It assumes upsample_kernel_size
as (3, ). You could simply set upsample_kernel_size=3
or upsample_kernel_size=(3)
.
In addition, the reason why it didn't happen in 1.0.0 is that the version at that time had these parameters hard-coded. https://github.com/Project-MONAI/MONAI/blob/170093375ce29267e45681fcec09dfa856e1d7e7/monai/networks/nets/attentionunet.py#L151 Hope it can help you. Thanks!
Describe the bug Simply put, it seems no matter what is used for the stride parameter in MONAI's implementation of AttentionUNet (https://docs.monai.io/en/stable/networks.html#attentionunet), one will either get an output of 'tuple index out of range' if the number of stride lengths provided is less than the length of the channel parameter minus 1 or 'expected stride to be a single integer value or a list of 1 values to match the convolution dimensions, but got stride=[2, 2]', where the value (in this case, 2) depends on what value you put in the list, if you have a list of the correct size.
For example, if the channels is (8, 16, 32, 64, 128) and the strides is (2, 2, 2, 2), it will produce this error. Interestingly, this error only appears in MONAI version 1.1.0, as in 1.0.0, it worked as I expected it would.
To Reproduce The following should reproduce the error:
The error
Expected behavior I expected this would not bring up a stride error. With 1.0.0, it did not, but with 1.1.0, it does. Playing with the strides parameter as a single integer value or a list with a single (or multiple) values does not seem to change this.
Screenshots If applicable, add screenshots to help explain your problem.
Environment
Ensuring you use the relevant python executable, please paste the output of:
python -c 'import monai; monai.config.print_debug_info()'
Output of the command:
Additional context I appreciate the support.