-
Notifications
You must be signed in to change notification settings - Fork 50
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 "LoadError: Numerically Inconsistent" #137
Comments
Do you have more of the stacktrace? The first line above is already from CDDLib, which is beyond our paygrade! |
I tried but am now not able to reproduce it with the same setup. I wonder if something with merging in master fixed it but it took restarting my environment to see that change? I am using Revise so I wouldn't have expected that and I had tried after my most recent merge. |
That may be because you were using the algorithm that now is called |
Thanks for the suggestion! I tried running with Ai2h() instead of Ai2() in master and it just runs indefinitely (instead of leading to an error). As a result, I'm still not sure what changed to make the old error disappear. |
The errors are perhaps related to how the inputs are used in the algorithm? Note that both Ai2h resp. the Ai2z approaches as shown below work fine in the example: input_set = HPolytope([HalfSpace([1.0, 0.0, 0.0, 0.0], 0.3845579517032085),
HalfSpace([0.0, 1.0, 0.0, 0.0], 0.8331193586918577),
HalfSpace([0.0, 0.0, 1.0, 0.0], 0.6607352829885846),
HalfSpace([0.0, 0.0, 0.0, 1.0], 0.270232549769154),
HalfSpace([-1.0, 0.0, 0.0, 0.0], 0.022984248429274823),
HalfSpace([0.0, -1.0, 0.0, 0.0], 1.061033037362016),
HalfSpace([0.0, 0.0, -1.0, 0.0], 0.734914583454296),
HalfSpace([0.0, 0.0, 0.0, -1.0], 0.7494557834041424)]);
# "Ai2h"
@time begin
H1 = overapproximate(network.layers[1].weights * input_set + network.layers[1].bias, Hyperrectangle)
H1 = rectify(H1)
H2 = overapproximate(network.layers[2].weights * H1 + network.layers[2].bias, Hyperrectangle);
end
0.006664 seconds (1.06 k allocations: 78.672 KiB)
Hyperrectangle{Float64,Array{Float64,1},Array{Float64,1}}([2.3950844668146862, -0.13751415227951902, -2.1096209129694556, -0.6299855269624741], [3.1193665559469745, 2.295359657778874, 2.454380545304072, 2.4271559068135793])
# "Ai2z"
@time begin
input_set = overapproximate(input_set, Hyperrectangle) # exact
input_set = convert(Zonotope, input_set) # also exact
Z1 = affine_map(network.layers[1].weights, input_set, network.layers[1].bias)
Z1 = overapproximate(Rectification(Z1), Zonotope)
Z2 = affine_map(network.layers[2].weights, Z1, network.layers[2].bias)
end
0.009373 seconds (536 allocations: 42.047 KiB)
Zonotope{Float64,Array{Float64,1},Array{Float64,2}}([1.7115830883645933, -0.23495075807030685, -2.11436002496305, -0.3868240216039214], [-0.32634300914634634 0.7369189071413871 … 0.18472489913317133 0.15586653347355545; 0.2154030641984947 0.5327045705827566 … -0.1545206676442892 0.015391252910196256; 0.038867901587761676 -0.5260435688205888 … -0.09919108055920038 0.1201795609033839; -0.20050663784682085 -0.44243336453491733 … 0.1539373002888789 -0.23997320951003187]) plot(project(H2, [1, 2]), lab="H2")
plot!(project(Z2, [1, 2]), lab="Z2") |
@mforets what you call |
ok, thanks.. i thought the out_Box = forward_network(Box(), network, input_set)
plot!(project(out_Box, [1, 2]), lab="Box")
out_Ai2z = forward_network(Ai2z(), network, input_set)
plot!(project(out_Ai2z, [1, 2]), lab="Ai2z") |
I also saw the call with Ai2h hang forever. When I interrupted eventually, I remember the stacktrace went through |
where/why is |
It is used in the old implementation, |
@mforets the h in |
With network:
Results in the following output and stacktrace:
The text was updated successfully, but these errors were encountered: