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

Bug reversing the direction of the gradient #1

Open
phdmatamoros opened this issue Dec 27, 2022 · 2 comments
Open

Bug reversing the direction of the gradient #1

phdmatamoros opened this issue Dec 27, 2022 · 2 comments

Comments

@phdmatamoros
Copy link

When I tried to train wassertein autoencoder , i have this error
d_z_loss.backward(-one)

RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([1]) and output[0] has a shape of torch.Size([]).

@gabrielctn
Copy link

I have the exact same error, did you find a solution ?

@gabrielctn
Copy link

It seems like replacing

one = torch.tensor([1], dtype=torch.float)

by

one = torch.tensor(1, dtype=torch.float)

works

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

2 participants