aboutsummaryrefslogtreecommitdiff
path: root/examples/verify_fashion_mnist.py
diff options
context:
space:
mode:
authorericmarin <maarin.eric@gmail.com>2026-03-31 16:43:47 +0200
committerericmarin <maarin.eric@gmail.com>2026-04-01 15:08:27 +0200
commit81d4d604aa43660b732b3538734a52d509d7c5df (patch)
treee0341280c3c3f10752aab7fccb2ddd5ed795c889 /examples/verify_fashion_mnist.py
parentd1b25fbde6b01529fd1bcfdd5778b6cb378eb865 (diff)
downloadvein-81d4d604aa43660b732b3538734a52d509d7c5df.tar.gz
vein-81d4d604aa43660b732b3538734a52d509d7c5df.zip
refactored examples
Diffstat (limited to 'examples/verify_fashion_mnist.py')
-rw-r--r--examples/verify_fashion_mnist.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/examples/verify_fashion_mnist.py b/examples/verify_fashion_mnist.py
deleted file mode 100644
index 91ca1ae..0000000
--- a/examples/verify_fashion_mnist.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import sys, os
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
-import z3
-import nneq
-
-def check_property(onnx_a, onnx_b, vnnlib):
- solver = nneq.Solver()
-
- print(f"--- Checking {vnnlib} ---")
-
- solver.load_onnx(onnx_a)
- solver.load_onnx(onnx_b)
- solver.load_vnnlib(vnnlib)
-
- result = solver.check()
-
- if result == z3.unsat:
- print("VERIFIED (UNSAT): The networks are equivalent under this property.")
- elif result == z3.sat:
- print("FAILED (SAT): The networks are NOT equivalent.")
- print("Counter-example input:")
- print(solver.model())
- # m = solver.model()
- # sorted_symbols = sorted([s for s in m.decls() if s.name().startswith("X_")], key=lambda s: s.name())
- # for s in sorted_symbols:
- # print(f" {s.name()} = {m[s]}")
- else:
- print("UNKNOWN")
- print("")
-
-if __name__ == "__main__":
- check_property("./examples/fashion_mnist/fashion_mnist_a.onnx", "./examples/fashion_mnist/fashion_mnist_b.onnx", "./examples/fashion_mnist/fashion_mnist_strict.vnnlib")
- check_property("./examples/fashion_mnist/fashion_mnist_a.onnx", "./examples/fashion_mnist/fashion_mnist_b.onnx", "./examples/fashion_mnist/fashion_mnist_epsilon.vnnlib")
- check_property("./examples/fashion_mnist/fashion_mnist_a.onnx", "./examples/fashion_mnist/fashion_mnist_b.onnx", "./examples/fashion_mnist/fashion_mnist_argmax.vnnlib")