From 346c33a842b88eaa992f65cecb5d34fd6487820b Mon Sep 17 00:00:00 2001 From: Francisco Massa Date: Sun, 1 May 2016 12:30:58 +0200 Subject: Fix in image.scale when one of the dimensions is too small If height or width is less than one after the resize, the tensor would have wrong dimensions (2 or 1 instead of 3) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index f2dda2c..80b5f06 100644 --- a/init.lua +++ b/init.lua @@ -648,6 +648,8 @@ local function scale(...) dok.error('could not find valid dest size', 'image.scale') end if not dst then + height = math.max(height, 1) + width = math.max(width, 1) if src:nDimension() == 3 then dst = src.new(src:size(1), height, width) else -- cgit v1.2.3