adorym icon indicating copy to clipboard operation
adorym copied to clipboard

Pytorch FFT changes

Open saugatkandel opened this issue 3 years ago • 4 comments

Starting in Pytorch 1.8, torch.fft is a module and not a function. So the FFT calls are now similar to that for numpy.

See: https://pytorch.org/blog/the-torch.fft-module-accelerated-fast-fourier-transforms-with-autograd-in-pyTorch/

I think the "adorym/adorym/wrappers.py" is the only file affected. Anywhere else?

saugatkandel avatar Sep 03 '21 18:09 saugatkandel

Yes, all usage of torch.fft should be through the wrapper. Also @saugatkandel in case you are interested in expanding Adorym, I've invited you as a collaborator. With that, when you find it necessary, you'll have control on accepting pull requests etc. for this repository.

mdw771 avatar Sep 03 '21 18:09 mdw771

Pytorch even supports complex numbers natively now, so it looks like a lot of operations could be simplified now. I will try this out as well.

saugatkandel avatar Sep 03 '21 18:09 saugatkandel

I think I've done the switch to complex numbers... at least for ptychography. I'm in the testing phase now. The master branch on my fork has the simple FFT conversion, while my dev is (I think) almost fully converted to complex numbers, and works. This generally gives me a pretty decent speed boost as well.

tcpekin avatar Oct 27 '22 14:10 tcpekin

Thanks @tcpekin. If you would like to, please feel free to submit a pull request.

mdw771 avatar Oct 27 '22 17:10 mdw771