DeepImageBlending icon indicating copy to clipboard operation
DeepImageBlending copied to clipboard

LBFGS raises Runtime Error

Open m-pektas opened this issue 3 years ago • 4 comments

When I run "run.py" script, I get the following error. Error raised from the optimizer. How can I solve this. Now, I can running only first stage without solved this issue.

Exception has occurred: RuntimeError
view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
  File "../DeepImageBlending/run.py", line 219, in <module>
    optimizer.step(closure)

m-pektas avatar Aug 21 '21 13:08 m-pektas

Have you solved the problem and how?Thanks!

samanthawyf avatar Nov 25 '21 10:11 samanthawyf

No, I couldn't solve it.

m-pektas avatar Nov 25 '21 13:11 m-pektas

I was able to solve this by changing line 171 from: first_pass_img = torch.from_numpy(first_pass_img).unsqueeze(0).transpose(1,3).transpose(2,3).float().to(gpu_id) to first_pass_img = torch.from_numpy(first_pass_img).unsqueeze(0).transpose(1,3).transpose(2,3).contiguous().float().to(gpu_id)

just making that img var contiguous.

arcosin avatar Dec 05 '21 05:12 arcosin

Oh my God, I solve this problem using this method. Thanks a lot!

TheWangYang avatar Oct 25 '22 11:10 TheWangYang