From ee97e644c893beb471207dac41520cce71bd10a0 Mon Sep 17 00:00:00 2001 From: schillic Date: Fri, 5 Jul 2024 13:29:13 +0200 Subject: [PATCH] unify BoxForward for monotonic activations --- src/ForwardAlgorithms/BoxForward.jl | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/ForwardAlgorithms/BoxForward.jl b/src/ForwardAlgorithms/BoxForward.jl index 1fdf490..90192a8 100644 --- a/src/ForwardAlgorithms/BoxForward.jl +++ b/src/ForwardAlgorithms/BoxForward.jl @@ -28,19 +28,10 @@ function forward(X::LazySet, ::ReLU, ::BoxForward) end # apply monotonic activation function -for ACT in (:Sigmoid, :Tanh) +for ACT in (:Sigmoid, :Tanh, :LeakyReLU) @eval function forward(X::LazySet, act::$ACT, ::BoxForward) + @assert isbounded(X) "this algorithm requires a bounded input set" l, h = extrema(X) return Hyperrectangle(; low=act(l), high=act(h)) end end - -# apply leaky-ReLU activation function -function forward(X::LazySet, act::LeakyReLU, ::BoxForward) - l, h = extrema(X) - if !(any(isinf, l) || any(isinf, h)) - return Hyperrectangle(; low=act(l), high=act(h)) - else - error("not implemented") - end -end