-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28] #161
Comments
Maybe your picture is a gray image, you should use a color picture |
|
之前改过了,transform = transforms.Compose([ |
这样改就好了 |
感谢😂 |
改成楼上确实好用 |
If you are still having the problem please use this code instead of above in place of tranform. |
@VinayMatcha This is not work for me ? I still get an error on this line .I think the parentheses is wrong |
@ladycatusa The snippet provided by @VinayMatcha does indeed correctly produce the correct output shape. I would recommend referencing this issue: fungtion/DANN#8 for as to why this occurring. |
I just ran into the same error message in a completely unrelated context, and changing the version of torchvision to 0.2.1 fixed it for me. Maybe this helps :) |
|
Let me clarify, if the img has three channels, you should have three number for mean, for example, img is RGB, mean is [0.5, 0.5, 0.5], the normalize result is R * 0.5, G * 0.5, B * 0.5. If img is grey type that only one channel, so mean should be [0.5], the normalize result is R * 0.5 |
改成这样之后,又报错了 |
If you're using pytorch>=1.0 or not? In pytorch 1.0, loss.item() replace loss.data[0] Anyway please change your code firstly if any issue happen please show more detail log to us. |
yes. I'm using pytorch 1.0. |
nice! it works! |
I got following error:RuntimeError: Given groups=1, weight of size 16 3 3 3, expected input[128, 1, 28, 28] to have 3 channels, but got 1 channels instead |
@ShuuTsubaki I also encounter to the problem. Do you find the way to fit it? |
Downgrading torch and torchvision to 0.2.0 and 0.2.1 solved this issue for me. |
just remove d._loss.data[0] and write d_loss.data it works for me. |
This Fixed the error for me: transform = transforms.Compose([transforms.ToTensor(), |
|
it is useful! |
transform = transforms.Compose([transforms.ToTensor(), |
its working i wrote in Normalize ((0.5) ,(0.5)) as func not as matrix |
worked for me. Thanks. |
Do you meet the problem that |
Can you please explain in short? What went wrong and how did this work? |
the model have three channels, only change the data loading way is useless,how to change the image to three channels? |
I just transformed all the images to Grayscale and boom, it worked like charm. This is my code: |
When I run GAN code, I got a runtime error
output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]
how fix it
The text was updated successfully, but these errors were encountered: