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

Tensor size not matchable #5

Open
tchaton opened this issue Apr 29, 2019 · 2 comments
Open

Tensor size not matchable #5

tchaton opened this issue Apr 29, 2019 · 2 comments

Comments

@tchaton
Copy link

tchaton commented Apr 29, 2019

python train.py give me

True
===> Using GPU to train
===> Loaing datasets
the image ndarray size is (682, 700, 3)
===> Initialize the image...
the image tensor size is torch.Size([1, 3, 682, 700])
===> Building the painterly model...
-----Setting up style layer-----
-----Setting up style layer-----
-----Setting up content layer-----
-----Setting up style layer-----
-----Setting up style layer-----
-----Setting up style layer-----
===> Optimizer running...
Traceback (most recent call last):
File "train.py", line 209, in
content_image, mask_image, tmask_image)
File "train.py", line 200, in run_painterly_transfer
optimizer.step(closure)
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/optim/lbfgs.py", line 103, in step
orig_loss = closure()
File "train.py", line 178, in closure
loss.backward()
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/tchaton/projects/original/Deep-Painterly-Harmonization-Pytorch/model.py", line 118, in style_hook
'grad_input:{} is not matchable with mask:{}'.format(grad_input[0].shape, self.mask.shape)
AssertionError: grad_input:torch.Size([1, 128, 170, 175]) is not matchable with mask:torch.Size([1, 1, 170, 175])

@yxwang-10
Copy link

Hello, I have the same question. Have you finished this problem?

1 similar comment
@Dttong
Copy link

Dttong commented Jul 30, 2020

Hello, I have the same question. Have you finished this problem?

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