torch / image

An Image toolbox for Torch.
Other
208 stars 141 forks source link

Fix bicubic interpolation when source has size 1 #161

Closed lvdmaaten closed 8 years ago

lvdmaaten commented 8 years ago

The bicubic interpolation code accesses non-allocated memory when src_len is 1 because it doesn't have a special case like bilinear interpolation does. This PR addresses that bug.

I ran the following test to confirm it works:

require 'image'
im = torch.randn(3, 2, 3):float()
for n = 1,1000 do resim = image.scale(im, 256, 768, 'bicubic') end
ajabri commented 8 years ago

like

soumith commented 8 years ago

Thanks Laurens!