diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/test/test.lua b/test/test.lua index 7a23c5e..5e4bce7 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1907,46 +1907,6 @@ function nntest.SpatialUpSamplingNearest() local ferr, berr = jac.testIO(m, input) mytester:asserteq(ferr, 0, torch.typename(m)..' - i/o forward err ') mytester:asserteq(berr, 0, torch.typename(m)..' - i/o backward err ') - - -- Also check that the forward prop is correct. - input = torch.rand(unpack(shape)) - local output = m:forward(input) - - local feat - local nfeats - if input:dim() == 3 then - nfeats = shape[1] - feat = {0} - else - feat = {0, 0} - nfeats = shape[1] * shape[2] - end - feat[#feat+1] = 0 -- ydim - feat[#feat+1] = 0 -- xdim - local xdim = input:dim() - local ydim = input:dim()-1 - local err = 0 - for f = 1, nfeats do - if input:dim() == 4 then - feat[1] = math.floor((f-1) / shape[1]) + 1 - feat[2] = math.mod((f-1), shape[2]) + 1 - else - feat[1] = f - end - for y = 1, input:size(ydim) * scale do - for x = 1, input:size(xdim) * scale do - feat[ydim] = y - feat[xdim] = x - local oval = output[feat] - feat[ydim] = math.floor((y-1)/scale)+1 - feat[xdim] = math.floor((x-1)/scale)+1 - local ival = input[feat] - err = math.max(err, math.abs(oval-ival)) - end - end - end - - mytester:assertlt(err, precision, ' fprop is incorrect ') end end |