diff options
author | nicholas-leonard <nick@nikopia.org> | 2014-07-27 09:50:33 +0400 |
---|---|---|
committer | nicholas-leonard <nick@nikopia.org> | 2014-07-27 09:50:33 +0400 |
commit | 7998ade5d524c5e4938a108e3c3c863606ceaf29 (patch) | |
tree | 91a0de01c91c370330bf3b014e099b69ea2c481f /test | |
parent | 958e3ba2cff6450b51646bbd46878e1effe170c7 (diff) |
MultiSoftMax works
Diffstat (limited to 'test')
-rw-r--r-- | test/test-all.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/test-all.lua b/test/test-all.lua index bb36e14..672c500 100644 --- a/test/test-all.lua +++ b/test/test-all.lua @@ -3,6 +3,10 @@ local nnxtest = {} local precision = 1e-5 local mytester +-- you can easily test specific units like this: +-- th -lnnx -e "nnx.test{'MultiSoftMax'}" +-- th -lnnx -e "nnx.test{'SoftMaxTree', 'Balance'}" + function nnxtest.SpatialPadding() local fanin = math.random(1,3) local sizex = math.random(4,16) @@ -513,7 +517,6 @@ function nnxtest.MultiSoftMax() local inputSize = 7 local nSoftmax = 5 local batchSize = 3 - local nBatch = 4 local input = torch.randn(batchSize, nSoftmax, inputSize) local gradOutput = torch.randn(batchSize, nSoftmax, inputSize) @@ -525,9 +528,9 @@ function nnxtest.MultiSoftMax() mytester:assert(gradOutput:isSameSizeAs(gradInput)) local sm = nn.SoftMax() - local input2 = input:view(nBatch*nSoftMax, inputSize) + local input2 = input:view(batchSize*nSoftmax, inputSize) local output2 = sm:forward(input2) - local gradInput2 = sm:backward(input2, gradOutput:view(nBatch*nSoftMax, inputSize)) + local gradInput2 = sm:backward(input2, gradOutput:view(batchSize*nSoftmax, inputSize)) mytester:assertTensorEq(output, output2, 0.000001) mytester:assertTensorEq(gradInput, gradInput2, 0.000001) |