mdw771 / adorym

Adorym: Automatic Differentiation-based Object Reconstruction with DynaMical Scattering
https://adorym.readthedocs.io/
25 stars 10 forks source link

Pytorch FFT changes #3

Open saugatkandel opened 3 years ago

saugatkandel commented 3 years ago

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?

mdw771 commented 3 years ago

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.

saugatkandel commented 3 years ago

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.

tcpekin commented 2 years ago

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.

mdw771 commented 2 years ago

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