Skip to content

Commit

Permalink
add assertion and improve BoxSolver
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed May 15, 2021
1 parent ed17af7 commit d51df59
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/nnops.jl
Expand Up @@ -101,15 +101,15 @@ function NeuralVerification.forward_network(solver::BoxSolver, nnet::Network, X0
W = layer.weights
b = layer.bias
X_am = AffineMap(W, X, b)
X_box = box_approximation(X_am)

# activation function
if layer.activation isa Id
X = X_box
X = X_am
continue
end

@assert layer.activation isa ReLU "unsupported activation function"
X = rectify(X_box)
X = rectify(box_approximation(X_am))
end
return X
end
Expand All @@ -126,6 +126,12 @@ function NeuralVerification.forward_network(solver::ConcreteReLU, nnet::Network,
X = reduce(vcat, X)
end
X = affine_map.(Ref(layer.weights), X, Ref(layer.bias))

# activation function
if layer.activation isa Id
continue
end
@assert layer.activation isa ReLU "unsupported activation function"
X = rectify.(X, solver.concrete_intersection)
end
return X
Expand Down

0 comments on commit d51df59

Please sign in to comment.