Machine-Learning-Collection icon indicating copy to clipboard operation
Machine-Learning-Collection copied to clipboard

fixed tensor size issue

Open lukevc opened this issue 3 years ago • 0 comments

RuntimeError: The size of tensor a (78) must match the size of tensor b (64) at non-singleton dimension 2

printing the shape of tensors real and fake inside of the gradient_penalty function in utils.py (directly before the images are interpolated) shows that real has height of 78 instead of 64. real = torch.Size([64, 3, 78, 64]) fake = torch.Size([64, 3, 64, 64])

Fixed the issue by changing transforms.Resize in train.py from transforms.Resize(IMAGE_SIZE) to transforms.Resize((IMAGE_SIZE, IMAGE_SIZE))

lukevc avatar Mar 31 '22 21:03 lukevc