# tflite_run
-A simple Tensorflow Lite runner. It measures the elapsed time and optionally dump the output data and compare them.
+A simple Tensorflow Lite runner. It measures the elapsed time and optionally dump the input/output tensors or verify them.
## Usage
$ ./tflite_run model.tflite
```
-### Specifying input data
-
-```
-$ ./tflite_run model.tflite
-```
-
Output would look like:
```
Invoke takes 7.09527 seconds
```
-### Dump the outputs
+### Specifying input feature map
+
+We can specify input feature map, but it only accepts preprocessed data which means that the image files must be converted.
-Dump the output tensors to a file.
+TODO : Add input image preprocessing instruction
```
+$ ./tflite_run model.tflite -i binary_input_file
+```
+
+### Dump the input and output tensors
+
+Dump the input and output tensors to a file.
+```
$ ./tflite_run model.tflite --dump golden
```
-The output tensors are written to name "golden".
+Why we do this is usually for later verification. The tensors are written to name "golden".
### Compare with the saved outputs
```
If `--compare` option is on, the exit code will be depend on its compare result. 0 for matched, other number for unmatched.
+
+## How Verification Works
+
+For verification, we may follow these steps:
+
+1. Generate and store the verfication data (run with option `--dump`)
+ 1. Input Tensor does not matter as we will keep inputs along with outputs
+ 1. Interpreter.Invoke()
+ 1. Dump input tensors and output tensors to a file
+1. Give the dumped file for other runtime that we want to verify (run with option `--compare`)
+ 1. Set interpreter's input to input tensor data from the file
+ 1. Interpreter.Invoke()
+ 1. Compare the results with output tensor data from the file