Skip to content

NP-Eng/verifiaml

Repository files navigation

VerifiaML

Testing & Examples

To run the tests, use cargo test.

To run the examples, use:

cargo run --example <example_name> --features "test-types"

where <example_name> is one of the following:

  • simple_perceptron_mnist_inference
  • simple_perceptron_mnist_proof
  • two_layer_perceptron_mnist_inference
  • two_layer_perceptron_mnist_proof

In order to run any tests involving python code, such as compatibility tests with TF Lite, the feature python must be activated (which automatically enables test-types).

From ndarray to QArray

In order to save a numpy ndarray (python side) as a serialised JSON which can be directly read into a QArray of ours (Rust side),

  • Convert the ndarray into an OrderedDict using our custom python function tensor_to_dict (available in several of the python notebooks)
  • Pass the resulting OrderedDict together with the destination path to json.dump.

The saved JSON file can be deserialised over in Rust with QArray::read(path: &str) -> QArray. If instead of a single OrderedDict, a python list of OrderedDicts is passed to json.dump, the resulting file can be deserialised with QArray::read_list(path: &str) -> Vec<QArray> .

Cf. exploring_tf_lite/training_two_layer_perceptron.ipynb for example usage.

This can be useful when bringing over to Rust some TF Lite model parameters or inputs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6