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

View File

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