Skip to content

Commit 90afcbf

Browse files
Merge pull request #480 from nicholas-leonard/BN-batchsize1
BN supports batchsize=1
2 parents e9ef2d5 + ab0ee1f commit 90afcbf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,9 +978,9 @@ local function BatchNormalization_backward(moduleName, mode, inputSize, backward
978978
end
979979
end
980980

981-
local function testBatchNormalization(name, dim, k)
981+
local function testBatchNormalization(name, dim, k, batchsize)
982982
local function inputSize()
983-
local inputSize = { torch.random(2,32), torch.random(1, k) }
983+
local inputSize = { batchsize or torch.random(2,32), torch.random(1, k) }
984984
for i=1,dim do
985985
table.insert(inputSize, torch.random(1,k))
986986
end
@@ -1005,6 +1005,7 @@ end
10051005

10061006
function cunntest.BatchNormalization()
10071007
testBatchNormalization('BatchNormalization', 0, 128)
1008+
testBatchNormalization('BatchNormalization', 0, 128, 1) -- test batchsize=1
10081009
end
10091010

10101011
function cunntest.SpatialBatchNormalization()

0 commit comments

Comments
 (0)