From 015c3550301fdc6d37606995322e144df0940ba2 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Wed, 23 Feb 2022 12:15:03 +0000 Subject: Add framework unit test generation scripts And fixes in tosa_verif_run_tests: * support for no-color printing * stop double printing of error messages on verbose * differentiate result code pass from results check Change-Id: I26e957013a8d18f7d3d3691067dfb778008a1eea Signed-off-by: Jeremy Johnson --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index d4aa5f9..97fef58 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ file using the `-o` switch. ## TOSA Unit Test Infrastructure -The TOSA Unit Test infrastruture builds and runs self-contained tests +The TOSA Unit Test infrastructure builds and runs self-contained tests for implementations of the *Tensor Operator Set Architecture (TOSA) Specification*. These tools directly generate TOSA operators for verification of the TOSA reference model against existing frameworks @@ -374,6 +374,45 @@ For an example of how to read these arguments in your SUT module, please see the `tosa_mock_sut_run.py` file. +### TOSA Framework Unit Tests + +Included in the TOSA Unit Test infrastructure are scripts to enable the creation +of TOSA unit tests for example frameworks. Included at the moment is support for +TensorFlow and TensorFlow Lite. + +#### Setup + +Installation (via `pip install`) of the following python package is required to +generate the tests: + +* `tensorflow` + +A built copy of the tensorflow framework from source is required to compile the +tests to TOSA - see the online documentation +on how to do this. +The following tools are used from this build: + +* `tensorflow/basel-bin/tensorflow/compiler/mlir/lite/flatbuffer_translate` +* `tensorflow/basel-bin/tensorflow/compiler/mlir/tf-opt` + +#### Usage + +The command to generate the unit test framework models: + +```bash +tosa_verif_framework_generator -o tests +``` + +Next to convert these models to TOSA and then run them on the reference model: + +```bash +tosa_verif_framework_compiler_runner \ + --tf-base-dir tensorflow \ + --tools-base-dir reference_model \ + --recursive \ + --test tests +``` + ## Other tools Included in this repository are some support utilities used by the test runner: -- cgit v1.2.1