Skip to content

Commit

Permalink
Merge pull request #196 from TimZaman/fix/warp-type-issue
Browse files Browse the repository at this point in the history
Fixes warp type-cast issue in #189
  • Loading branch information
soumith authored Oct 4, 2016
2 parents 88f4e3d + f682842 commit ad5a376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@ local function warp(...)
dok.error('Incorrect arguments (clamp_mode is not clamp | pad)!', 'image.warp')
end

local field = field:typeAs(torch.Tensor()) -- coerce matrix to default tensor type
local dim2 = false
if src:nDimension() == 2 then
dim2 = true
Expand Down
7 changes: 7 additions & 0 deletions test/test_warp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,10 @@ image.display{image = im_lanczos, zoom = 4, legend = 'rotation lanczos (pad 1)'}

image.display{image = im, zoom = 4, legend = 'source image'}

-- ***********************************************
-- NOW MAKE SURE BOTH FLOAT AND DOUBLE INPUTS WORK
-- ***********************************************

mtx = torch.zeros(2, 32, 32)
out = image.warp(im:float(), mtx:float(), 'bilinear')
out = image.warp(im:double(), mtx:double(), 'bilinear')

0 comments on commit ad5a376

Please sign in to comment.