Skip to content

Commit

Permalink
BN supports batchsize=1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Leonard committed Aug 3, 2017
1 parent e9ef2d5 commit ab0ee1f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -978,9 +978,9 @@ local function BatchNormalization_backward(moduleName, mode, inputSize, backward
end
end

local function testBatchNormalization(name, dim, k)
local function testBatchNormalization(name, dim, k, batchsize)
local function inputSize()
local inputSize = { torch.random(2,32), torch.random(1, k) }
local inputSize = { batchsize or torch.random(2,32), torch.random(1, k) }
for i=1,dim do
table.insert(inputSize, torch.random(1,k))
end
Expand All @@ -1005,6 +1005,7 @@ end

function cunntest.BatchNormalization()
testBatchNormalization('BatchNormalization', 0, 128)
testBatchNormalization('BatchNormalization', 0, 128, 1) -- test batchsize=1
end

function cunntest.SpatialBatchNormalization()
Expand Down

0 comments on commit ab0ee1f

Please sign in to comment.