You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 128 and 32 in dimension 2 at /opt/conda/conda-bld/pytorch_1549624239588/work/aten/src/TH/generic/THTensorMoreMath.cpp:1307
#1
Open
hinash88 opened this issue
Apr 1, 2019
· 1 comment
Thank you for sharing the code. I am new to learn GAN and when I run this code I face this following issue:
Traceback (most recent call last): File "main.py", line 341, in <module> G_log, D_log = train(epoch_max, batch_size) File "main.py", line 316, in train D_loss = train_D(real_images, real_labels) File "main.py", line 218, in train_D real_outputs = D.forward(real_images,real_labels_fill) File "main.py", line 137, in forward x = torch.cat((x, y), dim=1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 128 and 32 in dimension 2 at /opt/conda/conda-bld/pytorch_1549624239588/work/aten/src/TH/generic/THTensorMoreMath.cpp:1307
My batch size is 16 and i am running the code for 2 classes with 698 and 500 images respectively. My input images are 256x256 and I did not change any other parameter. These are the size of my x and y respectively where the problem occurs (main.py line 137)
Hi there,
Thank you for sharing the code. I am new to learn GAN and when I run this code I face this following issue:
Traceback (most recent call last): File "main.py", line 341, in <module> G_log, D_log = train(epoch_max, batch_size) File "main.py", line 316, in train D_loss = train_D(real_images, real_labels) File "main.py", line 218, in train_D real_outputs = D.forward(real_images,real_labels_fill) File "main.py", line 137, in forward x = torch.cat((x, y), dim=1) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 128 and 32 in dimension 2 at /opt/conda/conda-bld/pytorch_1549624239588/work/aten/src/TH/generic/THTensorMoreMath.cpp:1307
My batch size is 16 and i am running the code for 2 classes with 698 and 500 images respectively. My input images are 256x256 and I did not change any other parameter. These are the size of my x and y respectively where the problem occurs (main.py line 137)
torch.Size([16, 64, 128, 128]) torch.Size([16, 64, 32, 32])
Another problem is this code gives error when more than 2 classes are arranged in data folder.
Any kind of help is much appreciated!!!
The text was updated successfully, but these errors were encountered: