Skip to content
Snippets Groups Projects
Commit 66aceeb9 authored by François Bobot's avatar François Bobot
Browse files

[NN_prover] Some documentation

parent e2cd720a
No related branches found
No related tags found
No related merge requests found
...@@ -29,11 +29,6 @@ type new_output = { ...@@ -29,11 +29,6 @@ type new_output = {
term : Why3.Term.term; term : Why3.Term.term;
} }
(** invariant:
- input_vars from 0 to its length - 1
- outputs from length - 1 to 0 *)
exception UnknownLogicSymbol exception UnknownLogicSymbol
let create_new_nn env input_vars outputs : string = let create_new_nn env input_vars outputs : string =
...@@ -51,6 +46,8 @@ let create_new_nn env input_vars outputs : string = ...@@ -51,6 +46,8 @@ let create_new_nn env input_vars outputs : string =
Ir.Nier_simple.Node.gather_int input i) Ir.Nier_simple.Node.gather_int input i)
in in
let cache = Why3.Term.Hterm.create 17 in let cache = Why3.Term.Hterm.create 17 in
(* Instantiate the input of [old_nn] with the [old_nn_args] terms transformed
into node *)
let rec convert_old_nn (old_nn : Language.nn) old_index old_nn_args : let rec convert_old_nn (old_nn : Language.nn) old_index old_nn_args :
IR.GFloat.Node.t = IR.GFloat.Node.t =
let old_index = Why3.Number.to_small_integer old_index in let old_index = Why3.Number.to_small_integer old_index in
...@@ -64,7 +61,9 @@ let create_new_nn env input_vars outputs : string = ...@@ -64,7 +61,9 @@ let create_new_nn env input_vars outputs : string =
m "No parsed NN for '%s': %s" old_nn.nn_filename s) m "No parsed NN for '%s': %s" old_nn.nn_filename s)
| Ok { nier = Ok g; _ } -> g | Ok { nier = Ok g; _ } -> g
in in
(* Create the graph to replace the old input of the nn *)
let input () = let input () =
(* Regroup the terms into one node *)
let node = let node =
IR.Node.create IR.Node.create
(Concat { inputs = List.map ~f:convert_term old_nn_args; axis = 0 }) (Concat { inputs = List.map ~f:convert_term old_nn_args; axis = 0 })
...@@ -190,6 +189,7 @@ let create_new_nn env input_vars outputs : string = ...@@ -190,6 +189,7 @@ let create_new_nn env input_vars outputs : string =
Onnx.Simple.write nn filename; Onnx.Simple.write nn filename;
filename filename
(* Choose when to start the conversion to ONNX *)
let heuristic th_model th_nn term = let heuristic th_model th_nn term =
match term.Why3.Term.t_node with match term.Why3.Term.t_node with
| Tapp | Tapp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment