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

Expected object of scalar type Byte but got scalar type Bool for argument #107

Open
atopheim opened this issue Mar 27, 2020 · 4 comments · May be fixed by #109
Open

Expected object of scalar type Byte but got scalar type Bool for argument #107

atopheim opened this issue Mar 27, 2020 · 4 comments · May be fixed by #109

Comments

@atopheim
Copy link

Ran: python test.py --name coco_pretrained --dataset_mode coco --dataroot datasets/coco_stuff/ --gpu_ids -1

dataset [CocoDataset] of size 8 was created
Network [SPADEGenerator] was created. Total number of parameters: 97.5 million. To see the architecture, do print(network).
Traceback (most recent call last):
File "test.py", line 36, in
generated = model(data_i, mode='inference')
File "/home/torbjoern/anaconda3/envs/ml/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 42, in forward
input_semantics, real_image = self.preprocess_input(data)
File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 128, in preprocess_input
instance_edge_map = self.get_edges(inst_map)
File "/mnt/c/Users/torbjorn/Projects/Github/SPADE-master/models/pix2pix_model.py", line 240, in get_edges
edge[:, :, :, 1:] = edge[:, :, :, 1:] | (t[:, :, :, 1:] != t[:, :, :, :-1])
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other' in call to _th_or

Using torch 1.4.0

@freealise
Copy link

freealise commented Mar 30, 2020

Same with COCO (even the sample content) and Cityscapes datasets, but not ADE20k.

@xietao0306
Copy link

me too!

@lmxyy
Copy link

lmxyy commented Apr 25, 2020

Me too! I've fixed this issue.
I think this is the version issue of Pytorch 1.4. In pytorch 1.4, you could not conduct or operation between a ByteTensor and a BoolTensor. You need to cast the BoolTensor to ByteTensor like this

edge[:, :, :, 1:] = edge[:, :, :, 1:] | ((t[:, :, :, 1:] != t[:, :, :, :-1]).byte())

@atopheim
Copy link
Author

Indeed, works for me as well now, great that you figured it out :)

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

Successfully merging a pull request may close this issue.

4 participants