From f682842c84eff4885eb98bc6b51f70632186eb77 Mon Sep 17 00:00:00 2001 From: Tim Zaman Date: Tue, 4 Oct 2016 17:30:15 +0300 Subject: Fixes warp type-fixing issue in #189 --- init.lua | 1 - test/test_warp.lua | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 4d9350e..59c17a2 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/test/test_warp.lua b/test/test_warp.lua index 5c4a1ed..eb0a88e 100644 --- a/test/test_warp.lua +++ b/test/test_warp.lua @@ -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') -- cgit v1.2.3