-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fixed tensor type issue in affinetransform and warp #189
Conversation
Thanks! |
If the default tensor type is double, but the image is a float, this PR will make it fail. require 'torch'
require 'image'
torch.setdefaulttensortype('torch.DoubleTensor')
pr = image.lena():float()
makes_me = torch.zeros(2, 512, 512):double()
sad = image.warp(pr,makes_me,'bilinear') |
Hi @TimZaman , |
@chsasank , how about line 955? |
That doesn't seem to work if src is not default tensor type.
|
Do you agree that the above lua snippet a few comments back does not On Tuesday, 4 October 2016, Sasank Chilamkurthy [email protected]
|
Yeah, that does seem to be the case. The PR seems to be a bad attempt to fix bug #187 . I'm still figuring out where exactly the error is raised. I'd appreciate any help. One problem with |
It makes sense to introduce some code testing, also with the affineTransform. The warp function's argument-3 (field) has to be the same as the image's. |
It'd be nice if you can point where this check is enforced. I have gone through generic/image.c but couldn't find it. |
Fixes warp type-cast issue in #189
Refer to #187.
Previously the following code would've given an error:
This seems to be because
src.image.warp
expects field to be of default tensor type. This issue is fixed by coercing passed matrix or field to default tensor type.