Skip to content

Commit

Permalink
Merge pull request #203 from mldiego/master
Browse files Browse the repository at this point in the history
paddingMat = [] for Conv2D and s specification example for vnnlib
  • Loading branch information
mldiego authored Dec 8, 2023
2 parents c64fdcd + 7636b1c commit 6670eaa
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
14 changes: 13 additions & 1 deletion code/nnv/engine/nn/layers/Conv2DLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
end

obj.Bias = filter_bias;

if isempty(padding_mat)
padding_mat = [0 0 0 0];
end

p = size(padding_mat);

Expand Down Expand Up @@ -176,7 +180,11 @@
end

obj.Bias = filter_bias;


if isempty(padding_mat)
padding_mat = [0 0 0 0];
end

p = size(padding_mat);

if length(p) ~= 2 || p(2) ~= 4|| p(1) ~= 1
Expand Down Expand Up @@ -239,6 +247,10 @@
error('Inconsistency between filter weights and filter biases');
end

if isempty(padding_mat)
padding_mat = [0 0 0 0];
end

p = size(padding_mat);
if length(p) ~= 2 || p(2) ~= 4|| p(1) ~= 1
error('Invalid padding matrix');
Expand Down
45 changes: 45 additions & 0 deletions code/nnv/examples/other/exampleSumOutputAssertions.vnnlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; Based on AcasXu

(declare-const X_0 Real)
(declare-const X_1 Real)
(declare-const X_2 Real)
(declare-const X_3 Real)
(declare-const X_4 Real)

(declare-const Y_0 Real)
(declare-const Y_1 Real)
(declare-const Y_2 Real)
(declare-const Y_3 Real)
(declare-const Y_4 Real)

; INPUTS
;
(assert (<= X_0 0.679857769))
(assert (>= X_0 0.6))

(assert (<= X_1 0.5))
(assert (>= X_1 -0.5))

(assert (<= X_2 0.5))
(assert (>= X_2 -0.5))

(assert (<= X_3 0.5))
(assert (>= X_3 0.45))

(assert (<= X_4 -0.45))
(assert (>= X_4 -0.5))


; OUTPUTS
; what this technically means is that the sum of those boolean assertions has to be less than 0.25,
; which means that is more than two of the output conditions are found to be SAT, then the property is SAT.
;
(assert (>=
(+
(>= Y_0 3.991125645861615)
(>= Y_1 0.1)
(>= Y_2 0.0)
(>= Y_3 1.13243254354354)
(>= Y_4 2.24365465765787698)
) 0.25)
)

0 comments on commit 6670eaa

Please sign in to comment.