Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / tools / nnpackage_tool / sth2nnpkgtc / tflite2nnpkgtc.md
1 # tflite2nnpkgtc
2
3 `tflite2nnpkgtc` is a tool to convert tflite to nnpackage test case.
4 It takes `tflite` as input and generates `nnpackage` + golden data for value test.
5
6 ## prerequisite
7
8 Install tensorflow >= 1.12. It is tested with tensorflow 1.13, 1.14 and 2.0.
9
10 ## usage
11
12 ```
13 $ ./tflite2nnpkgtc.sh -h
14 Usage: tflite2nnpkgtc.sh [options] tflite
15 Convert tflite to nnpkg-tc
16
17 Returns
18      0       success
19   non-zero   failure
20
21 Options:
22     -h   show this help
23     -o   set output directory (default=.)
24
25 ```
26
27 ## example
28 ```
29 # @ host
30 $ tools/nnpackage_tool/sth2nnpkgtc/tflite2nnpkgtc.sh -o nnpkg-tcs cast.tflite
31 Generating nnpackage cast in nnpkg-tcs
32
33 # then, nnpkg is generated in $outdir/$basename
34 $ tree nnpkg-tcs/cast
35 nnpkg-tcs/cast
36 ├── cast.tflite
37 └── metadata
38     ├── MANIFEST
39     └── tc
40         ├── expected.h5
41         └── input.h5
42
43 # @ target
44 # run nnpkg with nnpackage_run and compare with h5diff
45 $ onert/test/onert-test nnpkg-test -i nnpkg-tcs cast
46 ```