megvii-research/DCLS-SR

IndexError: too many indices for tensor of dimension 4

Lincoln20030413 opened this issue · 3 comments

File "../../utils/dcls_utils.py", line 50, in inv_fft_kernel_est
+ ker_p[:, :, :, :, 1] * ker_p[:, :, :, :, 1]
IndexError: too many indices for tensor of dimension 4
作者你好,能帮我看看这个问题吗?

你的pytorch版本是多少呢?这个库的代码目前只支持pytorch1.7以下。

Hi. I also got same issue when I run the code.

My python and pytorch version are 3.7.12 and 1.12.1 because I used GTX3090 and Cuda 11.7.

Actually I corrected code as like below to run.

  • Original code : otf = torch.rfft(psf, 3, onesided=False)
  • Modified code : otf = torch.fft.rfft(psf, 3) or otf = torch.fft.fft(psf, 3)

is there any possibility of in-correct function usage due to my code correction?

If you can advise how to correct code, it will be great to me!

Thanks.

Hi. I also got same issue when I run the code.

My python and pytorch version are 3.7.12 and 1.12.1 because I used GTX3090 and Cuda 11.7.

Actually I corrected code as like below to run.

  • Original code : otf = torch.rfft(psf, 3, onesided=False)
  • Modified code : otf = torch.fft.rfft(psf, 3) or otf = torch.fft.fft(psf, 3)

is there any possibility of in-correct function usage due to my code correction?

If you can advise how to correct code, it will be great to me!

Thanks.

Perhaps you can ref this issue for higher pytorch version: #12 (comment)