From 385020e0e1611928184e353aa07144efcdcf4b5b Mon Sep 17 00:00:00 2001 From: nagadomi Date: Sun, 19 Feb 2017 01:42:40 +0900 Subject: [PATCH] Fix a bug of 763f5ddcabd9aa24ac7cc8faeb25f023cdb8eeb3 --- lib/pairwise_transform_utils.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pairwise_transform_utils.lua b/lib/pairwise_transform_utils.lua index ae2b30d..bb6edf9 100644 --- a/lib/pairwise_transform_utils.lua +++ b/lib/pairwise_transform_utils.lua @@ -127,11 +127,11 @@ function pairwise_transform_utils.active_cropping(x, y, lowres_y, size, scale, p if p < r then local xi = 0 local yi = 0 - if x:size(2) > size + 1 then - xi = torch.random(0, x:size(2) - (size + 1)) * scale - end if x:size(3) > size + 1 then - yi = torch.random(0, x:size(3) - (size + 1)) * scale + xi = torch.random(0, x:size(3) - (size + 1)) * scale + end + if x:size(2) > size + 1 then + yi = torch.random(0, x:size(2) - (size + 1)) * scale end local yc = iproc.crop(y, xi, yi, xi + size, yi + size) local xc = iproc.crop(x, xi / scale, yi / scale, xi / scale + size / scale, yi / scale + size / scale)