pytorch-poisson-image-editing
pytorch-poisson-image-editing copied to clipboard
Update functional.py
Green function and laplacion send to same device in case of using a cuda device
Thank you for your interest in this project!
I agree that this needs to be fixed (otherwise it won't run on GPU probably) but I don't think this is the way to do it. Although this would temporarily patch the error, I think we can fix it properly:
- Currently if
green_functionis passed in from the outside and it's on the wrong device, this would silently move it when we probably want to notify the user of the problem (as it could be a result of a bug somewhere else in their code).- Related, we should probably check the devices of all tensors at the start and give a nice error message if any mismatch
- It would be nicer to directly create
green_functionon the GPU, which we could do by passing a device parameter to the helper functions which do that.
If you are already thinking about these sort of things you can edit this pull request to improve it further if you'd like, otherwise I will reject this one and add the above changes myself