sedelmeyer / wasserstein-auto-encoder

A brief tutorial on the Wasserstein auto-encoder
84 stars 20 forks source link

Bug reversing the direction of the gradient #1

Open phdmatamoros opened 1 year ago

phdmatamoros commented 1 year ago

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 commented 1 year ago

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

gabrielctn commented 1 year ago

It seems like replacing

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

by

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

works