Skip to content

Commit

Permalink
add forward for FlattenLayerOp
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed May 25, 2024
1 parent 0231d85 commit 39f1ab9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
ControllerFormats = "0.2"
ControllerFormats = "0.2.3"
LazySets = "2.13"
LinearAlgebra = "<0.0.1, 1.6"
ReachabilityBase = "0.2.1"
Expand Down
5 changes: 5 additions & 0 deletions src/ForwardAlgorithms/DefaultForward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function forward(X::AbstractSingleton, net::FeedforwardNetwork, ::ForwardAlgorit
return forward(X, net, DefaultForward())
end

# flattening a ConvSet just unwraps the set
function forward(cs::ConvSet, ::FlattenLayerOp, ::ForwardAlgorithm=DefaultForward())
return cs.set
end

# propagate singleton through network and store all intermediate results
function _forward_store(X::AbstractSingleton, net::FeedforwardNetwork,
algo::DefaultForward=DefaultForward())
Expand Down
1 change: 1 addition & 0 deletions src/ForwardAlgorithms/ForwardAlgorithms.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module ForwardAlgorithms

using ..Util
using LinearAlgebra: Diagonal
using ControllerFormats
using LazySets
Expand Down
7 changes: 7 additions & 0 deletions test/ForwardAlgorithms/forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,10 @@ end
# not supported yet
@test_broken forward(X, N, Verisig())
end

@testset "Forward flattening layer" begin
S = Singleton(1:8)
dims = (2, 2, 2)
cs = ConvSet(S, dims)
@test forward(cs, FlattenLayerOp()) == S
end

0 comments on commit 39f1ab9

Please sign in to comment.