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:
authorSoumith Chintala <soumith@gmail.com>2015-07-09 10:48:11 +0300
committerSoumith Chintala <soumith@gmail.com>2015-07-09 10:48:11 +0300
commite0196922091ee55bf5e939b2863304641aec5ddc (patch)
tree64cbb67b03ee08b46c32877da598f25665a5d869 /test.lua
parentb7aa53d96fbb6c0f2eaa1976b28c5cf12edf1ced (diff)
parent350de823fcd43dcdc5948ef869d9ea135e2467a1 (diff)
Merge pull request #285 from sergomezcol/master
Add support for negative indices in nn.SplitTable
Diffstat (limited to 'test.lua')
-rw-r--r--test.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/test.lua b/test.lua
index 55818e1..82aefc8 100644
--- a/test.lua
+++ b/test.lua
@@ -2929,6 +2929,13 @@ function nntest.SplitTable()
module = nn.SplitTable(d, 2)
mytester:asserteq(#module:forward(input), input:size(d+1), "dimension " .. d)
end
+
+ -- Negative indices
+ local module = nn.SplitTable(-3)
+ local input = torch.randn(3,4,5)
+ mytester:asserteq(#module:forward(input), 3, "negative index")
+ local input = torch.randn(2,3,4,5)
+ mytester:asserteq(#module:forward(input), 3, "negative index (minibatch)")
end
function nntest.SelectTable()