Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Example 'Fig2Replication' #6

Closed
damianoazzolini opened this issue Aug 12, 2021 · 7 comments
Closed

Issue with Example 'Fig2Replication' #6

damianoazzolini opened this issue Aug 12, 2021 · 7 comments

Comments

@damianoazzolini
Copy link

Hi,
I'm trying to run the example 'Fig2Replication', but I get some errors in the part 'Fit model'.
The first is TypeError: 'module' object is not callable that comes from line 119 of disc_utils.py.
This can be fixed (I suppose) by replacing torch.fft with torch.fft.fft (also at line 120).
After that, however, there is an error at line 121: IndexError: index 1 is out of bounds for dimension 1 with size 1.

Any idea how to fix it?
Thanks

@TrentBrick
Copy link
Owner

Hi thanks for your issue and sorry for the slow reply!

What version of Pytorch are you using? It seems like a package issue. If you try PyTorch 1.2.0 then does it work?

@damianoazzolini
Copy link
Author

I get:

>>> import torch; print(torch.__version__)
1.9.0+cu102

so 1.9. Currently I cannot downgrade to version 1.2.0...

@TrentBrick
Copy link
Owner

I'm pretty sure it's a package issue. I haven't worked with FFT in a while and am not sure how to fix your particular bug. Apologies! If you do get a solution consider posting it here for others to find!

@damianoazzolini
Copy link
Author

I think there is indeed some package issues due to version changing: pytorch/pytorch#49637

@TrentBrick
Copy link
Owner

Well spotted and hopefully this gets resolved for future compatibility

@juancamilog
Copy link

juancamilog commented Sep 24, 2021

This is an easy fix: the api is greatly simplified since complex numbers are supported out of the box (dtype complex64). one_hot_add becomes torch.fft.ifft(torch.fft.fft(inputs) * torch.fft.fft(shift)).real, which is pretty much the same as in the edward implementation

@TrentBrick
Copy link
Owner

@juancamilog thanks for sharing this! Going to close this but will point to your answer for anyone using 1.9 or higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants