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: output with shape [1, 256, 192] doesn't match the broadcast shape [3, 256, 192] #8

Open
17sushmita opened this issue Jun 1, 2020 · 2 comments

Comments

@17sushmita
Copy link

Getting this error while running train_gmm.py

Namespace(batch_size=16, data_root='data', fine_height=256, fine_width=192, gpu_id='0', grid_size=5, log_freq=100, n_epoch=100, n_worker=16, name='GMM', out_dir='../result', radius=5)
Loading dataset
Building GMM model
Total Parameters: 19057650
Start training GMM
0% 0/100 [00:00<?, ?it/s]Epoch: 0

epoch: 0: 0% 0/1 [00:00<?, ?it/s]
0% 0/100 [00:00<?, ?it/s]
Traceback (most recent call last):
File "train_gmm.py", line 140, in
main()
File "train_gmm.py", line 127, in main
loss = trainer.train(epoch)
File "train_gmm.py", line 33, in train
return self.iteration(epoch, self.dataloader_train)
File "train_gmm.py", line 45, in iteration
for i, _data in data_iter:
File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1104, in iter
for obj in iterable:
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 345, in next
data = self._next_data()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 395, in reraise
raise self.exc_type(msg)
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/drive/My Drive/viton-gan/viton_gan/dataset.py", line 155, in getitem
data = self._get_item_base(index)
File "/content/drive/My Drive/viton-gan/viton_gan/dataset.py", line 103, in get_item_base
feature_shape_tensor = self.transform(self.downsample(shape_im)) # [-1,1]
File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py", line 61, in call
img = t(img)
File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py", line 166, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py", line 208, in normalize
tensor.sub
(mean).div
(std)
RuntimeError: output with shape [1, 256, 192] doesn't match the broadcast shape [3, 256, 192]

epoch: 0: 0% 0/1 [00:00<?, ?it/s]

@Naveen-Nanda
Copy link

Has this problem been fixed?

@tasinislam21
Copy link

I had this problem before but on a different repository. I fixed it by using a specific version of PyTorch. Use pytorch 0.4.1 and torchvision 0.2.1

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

3 participants