diff --git a/src/Architecture/DenseLayerOp.jl b/src/Architecture/DenseLayerOp.jl index bd613ae..40dd1fe 100644 --- a/src/Architecture/DenseLayerOp.jl +++ b/src/Architecture/DenseLayerOp.jl @@ -33,7 +33,8 @@ function _isconsistent(weights, bias) return size(weights, 1) == length(bias) end -(l::DenseLayerOp)(x) = l.activation.(l.weights * x .+ l.bias) +# application to a vector +(L::DenseLayerOp)(x) = L.activation.(L.weights * x .+ L.bias) Base.length(L::DenseLayerOp) = length(L.bias) diff --git a/test/Architecture/AbstractLayerOp.jl b/test/Architecture/AbstractLayerOp.jl new file mode 100644 index 0000000..c42c2e9 --- /dev/null +++ b/test/Architecture/AbstractLayerOp.jl @@ -0,0 +1,5 @@ +# AbstractLayerOp implementation +struct TestLayerOp <: AbstractLayerOp end +L = TestLayerOp() +dim_in(L) +dim_out(L) diff --git a/test/Architecture/DenseLayerOp.jl b/test/Architecture/DenseLayerOp.jl index 2655a14..46989d9 100644 --- a/test/Architecture/DenseLayerOp.jl +++ b/test/Architecture/DenseLayerOp.jl @@ -1,11 +1,5 @@ using ReachabilityBase.Subtypes: subtypes -# AbstractLayerOp implementation -struct TestLayerOp <: AbstractLayerOp end -L = TestLayerOp() -dim_in(L) -dim_out(L) - # 2D input vector and 2x3 layer x = [1.0, 1] W = hcat([1 0.5; -0.5 0.5; -1 -0.5]) diff --git a/test/runtests.jl b/test/runtests.jl index 748c6f7..5a06c1d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,6 +7,9 @@ import Flux, MAT, ONNX, YAML struct TestActivation <: ActivationFunction end @testset "Architecture" begin + @testset "AbstractLayerOp" begin + include("Architecture/AbstractLayerOp.jl") + end @testset "DenseLayerOp" begin include("Architecture/DenseLayerOp.jl") end