Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ai2{Hyperrectangle} Id layer returns Zonotope #141

Open
SebastianGuadalupe opened this issue Aug 3, 2020 · 1 comment
Open

Ai2{Hyperrectangle} Id layer returns Zonotope #141

SebastianGuadalupe opened this issue Aug 3, 2020 · 1 comment
Labels
pressing issue Something important depends on this

Comments

@SebastianGuadalupe
Copy link
Contributor

SebastianGuadalupe commented Aug 3, 2020

The current implementation is

function forward_layer(solver::Ai2, L::Layer{Id}, input)
    return affine_map(L, input)
end

but what I understand is correct would be

forward_layer(solver::Ai2, L::Layer{Id}, input) = input

Edit: This is not true, but there is a type instability in the function, when passing a Hyperrectangle, it returns a Zonotope

@SebastianGuadalupe SebastianGuadalupe changed the title Ai2 Id layer not working as intended Type instability in Ai2 Id layer Aug 3, 2020
@tomerarnon tomerarnon changed the title Type instability in Ai2 Id layer Ai2{Hyperrectangle} Id layer returns Zonotope Aug 3, 2020
@tomerarnon
Copy link
Collaborator

Technically this is not a type instability, since the return type of affine_map(L, ::Hyperrectangle) is inferable (always a Zonotope). I don't think this is really a problem, except that it is maybe surprising to get a Zonotope out of the Box solver (even though that is more precise than overapproximating the output as a hyperrectangle). Although it loses a bit of precision, I wouldn't mind changing it to return a hyperrectangle, which I think matches your original implementation.

I did note a bug looking into this that we haven't run into because we haven't tested with any networks that have identity layers in the middle (always at the end)

function forward_layer(solver::Box, L::Layer{ReLU}, input::AbstractZonotope)
= approximate_affine_map(L, input)
return rectify(Ẑ)
end

approximate_affine_map above wouldn't actually work for AbstractZonotope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pressing issue Something important depends on this
Projects
None yet
Development

No branches or pull requests

2 participants