Tests for batch norm with 2D and 3D convolutions.

This commit is contained in:
Brad Safnuk 2018-03-15 22:52:09 -04:00
parent db2d9efb72
commit 07b0f95d61
1 changed files with 15 additions and 3 deletions

View File

@ -78,9 +78,21 @@ end
@test x[1] σ((1 - 0.3) / 1.1449489742783179)
end
let m = BatchNorm(2), x = param(reshape(1:12, 2, 2, 3))
y = reshape(permutedims(x, [2, 1, 3]), 2, 6)
y = permutedims(reshape(m(y), 2, 2, 3), [2, 1, 3])
let m = BatchNorm(2), x = param(reshape(1:6, 3, 2, 1))
y = reshape(permutedims(x, [2, 1, 3]), 2, :)
y = permutedims(reshape(m(y), 2, 3, 1), [2, 1, 3])
@test m(x) == y
end
let m = BatchNorm(2), x = param(reshape(1:12, 2, 3, 2, 1))
y = reshape(permutedims(x, [3, 1, 2, 4]), 2, :)
y = permutedims(reshape(m(y), 2, 2, 3, 1), [2, 3, 1, 4])
@test m(x) == y
end
let m = BatchNorm(2), x = param(reshape(1:24, 2, 2, 3, 2, 1))
y = reshape(permutedims(x, [4, 1, 2, 3, 5]), 2, :)
y = permutedims(reshape(m(y), 2, 2, 2, 3, 1), [2, 3, 4, 1, 5])
@test m(x) == y
end
end