another small test
This commit is contained in:
parent
2161163a82
commit
0a2e288c3f
@ -56,6 +56,27 @@ end
|
|||||||
@test size(x_hat) == size(x)
|
@test size(x_hat) == size(x)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "CrossCor" begin
|
||||||
|
x = rand(Float32, 28, 28, 1, 1)
|
||||||
|
w = rand(2,2,1,1)
|
||||||
|
y = CrossCor(w, [0.0])
|
||||||
|
|
||||||
|
@test sum(w .* x[1:2, 1:2, :, :]) == y(x)[1, 1, 1, 1]
|
||||||
|
|
||||||
|
r = zeros(Float32, 28, 28, 1, 5)
|
||||||
|
m = Chain(
|
||||||
|
CrossCor((2, 2), 1=>16, relu),
|
||||||
|
MaxPool((2,2)),
|
||||||
|
CrossCor((2, 2), 16=>8, relu),
|
||||||
|
MaxPool((2,2)),
|
||||||
|
x -> reshape(x, :, size(x, 4)),
|
||||||
|
Dense(288, 10), softmax)
|
||||||
|
|
||||||
|
@test size(m(r)) == (10, 5)
|
||||||
|
@test y(x) != Conv(w, [0.0])(x)
|
||||||
|
@test CrossCor(w[end:-1:1, end:-1:1, :, :], [0.0])(x) == Conv(w, [0.0])(x)
|
||||||
|
end
|
||||||
|
|
||||||
@testset "Conv with non quadratic window #700" begin
|
@testset "Conv with non quadratic window #700" begin
|
||||||
data = zeros(Float32, 7,7,1,1)
|
data = zeros(Float32, 7,7,1,1)
|
||||||
data[4,4,1,1] = 1
|
data[4,4,1,1] = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user