Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/image.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Massa <fvsmassa@gmail.com>2016-05-01 13:30:58 +0300
committerFrancisco Massa <fvsmassa@gmail.com>2016-05-01 17:52:53 +0300
commit346c33a842b88eaa992f65cecb5d34fd6487820b (patch)
tree47510e2f81a3641321eadf2f4f1f6041c7aca2aa
parent0680e1fc7b99c0d6aaebc2985aa4df18f082c1b9 (diff)
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)
-rw-r--r--init.lua2
1 files changed, 2 insertions, 0 deletions
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