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

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

Open
Tylersuard opened this issue Apr 15, 2020 · 4 comments

Comments

@Tylersuard
Copy link

Traceback (most recent call last):
File "train.py", line 124, in
D_real.backward(neg_one) # loss * -1
File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 195, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 93, in backward
grad_tensors = _make_grads(tensors, grad_tensors)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 29, in _make_grads
+ str(out.shape) + ".")
RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([1]) and output[0] has a shape of torch.Size([]).

@DWhettam
Copy link

DWhettam commented Jun 1, 2020

Any luck with this issue? I've tried training on the piano data and I'm getting the same issue. I'm running on a cluster so not able to put the training data in the same directory as the code, but I've specified the directory in args.audio_dir

@DWhettam
Copy link

DWhettam commented Jun 2, 2020

Resolved:
change one = torch.Tensor([1]).float() to one = torch.tensor(1, dtype=torch.float) on line 104.

I also had to change to change the print statement on line 213 to do non-integer division:
if i % (BATCH_NUM / 5) == 0:

@mazzzystar
Copy link
Owner

Hi, sorry for the late response.
The implementation was done in 2018, so I think this should be PyTorch version issue.

@sandip-baidya
Copy link

Hey, the fix worked
but all the samples generated after training don't carry any sounds at all. I don't know why that's happening. Was there a problem during converting them from numpy arrays to .wav files?

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

4 participants