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

Namespace conflict error when using alongside Flux #187

Open
rlipkis opened this issue Mar 29, 2021 · 0 comments
Open

Namespace conflict error when using alongside Flux #187

rlipkis opened this issue Mar 29, 2021 · 0 comments

Comments

@rlipkis
Copy link

rlipkis commented Mar 29, 2021

Hi,

I've run into a bit of an issue when using your package. The @requires statement causes Flux to be loaded in full inside NeuralVerification if it's used in Main at any point. This causes a conflict with the symbol σ, which is exported by both LazySets and Flux.

A MWE is Flux + the script given in the README, used with a reachability-based solver,

using NeuralVerification
using NeuralVerification: Hyperrectangle
using Flux

solver = ReluVal()
nnet = read_nnet("test/networks/small_nnet.nnet")
input_set  = Hyperrectangle(low = [-1.0], high = [1.0])
output_set = Hyperrectangle(low = [-1.0], high = [70.0])
problem = Problem(nnet, input_set, output_set)

solve(solver, problem)

which errors with the message

WARNING: both Flux and LazySets export "σ"; uses of it in module NeuralVerification must be qualified
ERROR: UndefVarError: σ not defined
Stacktrace:
 [1] upper_bound(a::LazySets.Arrays.SingleEntryVector{Float64}, set::LazySets.AffineMap{Float64, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Float64, SubArray{Float64, 2, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, UnitRange{Int64}}, true}, SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:141
 [2] upper_bound
   @ ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:145 [inlined]
 [3] forward_act(#unused#::ReluVal, L::NeuralVerification.Layer{NeuralVerification.ReLU, Float64}, input::NeuralVerification.SymbolicIntervalGradient{Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Bool})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\reluVal.jl:107
 [4] forward_layer(solver::ReluVal, layer::NeuralVerification.Layer{NeuralVerification.ReLU, Float64}, reach::NeuralVerification.SymbolicIntervalGradient{Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Bool})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:59
 [5] _forward_network(solver::ReluVal, nnet::Network, input::NeuralVerification.SymbolicIntervalGradient{Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Bool})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:26
 [6] #forward_network#78
   @ ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:18 [inlined]
 [7] forward_network(solver::ReluVal, nnet::Network, input::NeuralVerification.SymbolicIntervalGradient{Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Bool})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\utils\reachability.jl:13
 [8] solve(solver::ReluVal, problem::Problem{Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}, Hyperrectangle{Float64, Vector{Float64}, Vector{Float64}}})
   @ NeuralVerification ~\.julia\packages\NeuralVerification\zWjPO\src\reachability\reluVal.jl:44
 [9] top-level scope
   @ REPL[9]:1

I think if the using statement in utils/flux.jl were qualified with only the required names, it would avert the conflict.

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

No branches or pull requests

1 participant