actually run tests

This commit is contained in:
Mike J Innes 2018-09-04 14:35:20 +01:00
parent 1e0fd07b09
commit 1e90226077
2 changed files with 14 additions and 16 deletions

View File

@ -1,8 +1,7 @@
using Test
using Flux: Chain, Conv, MaxPool, MeanPool, maxpool, meanpool
using Base.conv
using Flux, Test
using Flux: maxpool, meanpool
@testset "pooling" begin
@testset "Pooling" begin
x = randn(10, 10, 3, 2)
mp = MaxPool((2, 2))
@test mp(x) == maxpool(x, (2,2))
@ -10,17 +9,15 @@ using Base.conv
@test mp(x) == meanpool(x, (2,2))
end
@testset "cnn" begin
r = zeros(28, 28)
m = Chain(
Conv((2, 2), 1=>16, relu),
MaxPool{2}(2),
Conv((2, 2), 16=>8, relu),
MaxPool{2}(2),
x -> reshape(x, :, size(x, 4)),
Dense(288, 10), softmax)
@testset "CNN" begin
r = zeros(28, 28, 1, 5)
m = Chain(
Conv((2, 2), 1=>16, relu),
MaxPool((2,2)),
Conv((2, 2), 16=>8, relu),
MaxPool((2,2)),
x -> reshape(x, :, size(x, 4)),
Dense(288, 10), softmax)
@testset "inference" begin
@test size(m(r)) == (10, )
end
@test size(m(r)) == (10, 5)
end

View File

@ -28,6 +28,7 @@ include("onehot.jl")
include("tracker.jl")
include("layers/normalisation.jl")
include("layers/stateless.jl")
include("layers/conv.jl")
include("optimise.jl")
include("data.jl")