torch-dct
torch-dct copied to clipboard
Pytorch 1.8 and 1.9 compatibility
This version should be compatible with multiple PyTorch versions (it works at least on 1.6.0, 1.7.1, 1.8.1, 1.9.0).
This fix is based on suggestions from this comment https://github.com/zh217/torch-dct/issues/15#issuecomment-851439294 by @SunnerLi and on existing but not fully working PR https://github.com/zh217/torch-dct/pull/21 by @underdogliu.
My version does not use version checking during execution of dct calculation. Instead it tries to import new torch.fft
module and conditionally defines three functions using either new or old implementation of FFT. This is done only once, when module is imported.
Thanks a lot! Will have a check this week on some testing on numerical compatibility and version compatibility.
And actually, as a contributor I am thinking about dropping support before 1.7. @zh217 your thoughts?
This implementation may encounter an error: "copy_" not implemented for 'ComplexHalf'.
Sorry @jbojar I have been so busy to get back to this. Finally can have a look.
Yes I think your solution works ok, although I still recommend two things:
- Tweak on numerical accuacy (for example, using float, using numpy floating numbers....) to reduce errors. I tested your code with torch==1.9.1 with the case in README and got the error at level of 1e-5. I think it is a bit high, although my solution from #21 returns same.
- adding version checking or complete dropping torch<=1.7.1 off because state-of-the-art solutions should provide support on torch>=1.8.0 and python>=3.7.
@lryta I copied his code to my repo and did not encounter such error. I used torch==1.9.1.
I have not heard any news about @zh217.
any news on this to be merged?
Can this be merged? Currently things do not work at all with Pytorch 1.10
Any plans on merging?
@jonnor I think it is ready to merge. But obviously I do not have the permission. Maybe you can clone the repo from this PR and compile it locally in your conda/VM environment.
@underdogliu I tried again @1.10.1 and I still encountered the same issue. I may look into it during the new year break.
@zh217 Can you please merge this?
Any plans on this being merged?
Checked with python 3.10 Cuda 11.6 and pytorch 1.11.0. GPU: 3090 FE
tested on pytorch 1.12dev and cuda 11.6 and works fine!
Could we please have this merged in?
Thank you for merging @zh217 ! Can you also make a new release on PyPi? Then it would be easy to use the package again
Now it's available on PyPi as version 0.1.6.
Thank you @zh217 ! I have installed it via pip, seems to work fine