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
path: root/test
diff options
context:
space:
mode:
authorSergio Gomez <sergomezcol@gmail.com>2014-06-30 19:39:16 +0400
committerSergio Gomez <sergomezcol@gmail.com>2014-06-30 19:42:18 +0400
commitddfe535a7900939136f40773847f5b1152643a2a (patch)
treeb610aa66a7906d54c5e2daa76d0e20aebb81ae70 /test
parent814fba19f5c2168e29a377941b4711bfa39665e8 (diff)
Add setNumInputDims() method to nn.View
This allows to use minibatches when using -1 for one of the sizes.
Diffstat (limited to 'test')
-rw-r--r--test/test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index 5e4bce7..88adf96 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -1884,6 +1884,13 @@ function nntest.View()
mytester:assertTableEq(module:forward(minibatch):nElement(),
minibatch:nElement(),
"Error in minibatch nElement")
+ local module = nn.View(-1):setNumInputDims(1)
+ mytester:assertTableEq(module:forward(minibatch):size(1),
+ minibatch:size(1),
+ "Error in minibatch dimension with size -1")
+ mytester:assertTableEq(module:forward(minibatch):nElement(),
+ minibatch:nElement(),
+ "Error in minibatch nElement with size -1")
end
-- Define a test for SpatialUpSamplingCuda