-
Notifications
You must be signed in to change notification settings - Fork 546
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: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28] #33
Comments
if you are using mnist as your dataset, which only have 1 channel of input, it will occur. |
@WhiteGL Now when I run
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I run your CGAN program ,the following error message has occured:
D:\ProgramData\Anaconda3\python.exe I:/gupaocode/pytorch-generative-model-collections-master/main.py --dataset mnist --gan_type CGAN --epoch 50 --batch_size 64
Traceback (most recent call last):
File "I:/gupaocode/pytorch-generative-model-collections-master/main.py", line 111, in
main()
File "I:/gupaocode/pytorch-generative-model-collections-master/main.py", line 82, in main
gan = CGAN(args)
File "I:\gupaocode\pytorch-generative-model-collections-master\CGAN.py", line 94, in init
data = self.data_loader.iter().next()[0]
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 517, in next
data = self._next_data()
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 557, in _next_data
data = self.dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\ProgramData\Anaconda3\lib\site-packages\torchvision\datasets\mnist.py", line 106, in getitem
img = self.transform(img)
File "D:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 60, in call
img = t(img)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 889, in call_impl
result = self.forward(*input, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 221, in forward
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "D:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms\functional.py", line 336, in normalize
tensor.sub(mean).div(std)
RuntimeError: output with shape [1, 28, 28] doesn't match the broadcast shape [3, 28, 28]
The text was updated successfully, but these errors were encountered: