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

github.com/torch/nn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAysegul Dundar <adundar@purdue.edu>2015-01-17 17:58:51 +0300
committersoumith <soumith@fb.com>2015-01-20 04:35:57 +0300
commit0298277b5e2478668bf82c0cef7b401139f9dc89 (patch)
tree10e69ca7f290df373820ea1044f7cc0669261a50 /test.lua
parenta9768c444f4a455fc8a7654981350c9ecc6e7aee (diff)
SpatialConvolutionMM supports dw/dh != 1
Diffstat (limited to 'test.lua')
-rw-r--r--test.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/test.lua b/test.lua
index 0085cc5..ef1dda5 100644
--- a/test.lua
+++ b/test.lua
@@ -1095,15 +1095,18 @@ function nntest.SpatialConvolution()
end
function nntest.SpatialConvolutionMM()
- local from = math.random(1,5)
+ local from = math.random(2,5)
local to = math.random(1,5)
- local ki = math.random(1,3)
- local kj = math.random(1,3)
+ local ki = math.random(1,5)
+ local kj = math.random(1,5)
+ local di = math.random(1,4)
+ local dj = math.random(1,4)
+ local padding = math.random(0,2)
local outi = math.random(5,9)
local outj = math.random(5,9)
- local ini = outi-1+ki
- local inj = outj-1+kj
- local module = nn.SpatialConvolutionMM(from, to, ki, kj)
+ local ini = (outi-1)*di+ki-padding*2
+ local inj = (outj-1)*dj+kj-padding*2
+ local module = nn.SpatialConvolutionMM(from, to, ki, kj, di, dj, padding)
local input = torch.Tensor(from, inj, ini):zero()
-- stochastic
@@ -1137,11 +1140,8 @@ function nntest.SpatialConvolutionMM()
--verbose = true
local batch = math.random(2,5)
- outi = math.random(4,8)
- outj = math.random(4,8)
- ini = outi-1+ki
- inj = outj-1+kj
- module = nn.SpatialConvolutionMM(from, to, ki, kj)
+
+ module = nn.SpatialConvolutionMM(from, to, ki, kj, di, dj, padding)
input = torch.Tensor(batch,from,inj,ini):zero()
local err = jac.testJacobian(module, input)