Skip to content

Commit 09ea29f

Browse files
authored
Refactor LeakyReLU test cases for input star creation
1 parent a1a8d5d commit 09ea29f

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

code/nnv/tests/nn/funcs/leakyrelu/test_LeakyReLU.m

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919

2020
%% Test 3: LeakyReLU reach exact star with crossing zero
2121
% Create a star set that crosses zero
22-
V = [0 1 1; 1 0 1; 1 1 0]; % base vectors
23-
C = [1; -1]; % constraints
24-
d = [1; 1]; % constraint bounds
2522
lb = [-1; -1];
2623
ub = [1; 1];
2724

28-
I = Star(V, C, d, lb, ub);
25+
I = Star(lb, ub);
2926
gamma = 0.01;
3027

3128
S = LeakyReLU.reach(I, gamma, 'exact-star');
@@ -35,11 +32,7 @@
3532
% Create input star
3633
lb = [-1; -1];
3734
ub = [1; 1];
38-
B = Box(lb, ub);
39-
I_zono = B.toZono;
40-
A = [0.5 1; 1.5 -2];
41-
I_zono = I_zono.affineMap(A, []);
42-
I_star = I_zono.toStar;
35+
I_star = Star(lb,ub);
4336

4437
gamma = 0.1;
4538
S = LeakyReLU.reach(I_star, gamma, 'approx-star');
@@ -56,12 +49,9 @@
5649
assert(isa(Z, 'Zono'), 'LeakyReLU reach approx-zono should return Zono');
5750

5851
%% Test 6: LeakyReLU stepReach with positive range
59-
V = [1; 2];
60-
C = [];
61-
d = [];
62-
lb = [0.5];
63-
ub = [2.5];
64-
I = Star(V, C, d, lb, ub);
52+
lb = [0.5;1];
53+
ub = [2.5;2];
54+
I = Star(lb, ub);
6555

6656
gamma = 0.01;
6757
index = 1;
@@ -72,12 +62,9 @@
7262
assert(isequal(S.V, I.V), 'stepReach with positive range should not change V');
7363

7464
%% Test 7: LeakyReLU stepReach with negative range
75-
V = [0 1; 0 1];
76-
C = [1; -1];
77-
d = [0; 0];
78-
lb = [-1];
79-
ub = [-0.1];
80-
I = Star(V, C, d, lb, ub);
65+
lb = [-1;-10];
66+
ub = [-0.1; -8];
67+
I = Star(lb, ub);
8168

8269
gamma = 0.1;
8370
index = 1;

0 commit comments

Comments
 (0)