diff options
Diffstat (limited to 'tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md')
-rw-r--r-- | tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md b/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md new file mode 100644 index 000000000..9cf6ab141 --- /dev/null +++ b/tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.md @@ -0,0 +1,61 @@ +# pb2nnpkgtc + +`pb2nnpkgtc` is a tool to select a subgraph of pb model and convert to `nnpackage` with golden data and generated pb. + +It takes `pb` as input and generates `nnpackage`. + +## prerequisite + +Install tensorflow >= 1.12. It is tested with tensorflow 1.13, 1.14 and 2.0. + +Install node. (Any version will do. I recommend you to use `nvm`.) + +Set environmet variables from usage below. + +## usage + +``` +$ ./pb2nnpkgtc.sh -h +Usage: pb2nnpkgtc.sh [options] pb inputs outputs +Convert pb to nnpkg-tc + +Returns + 0 success + non-zero failure + +Options: + -h show this help + -o set output directory (default=.) + +Environment variables: + flatc path to flatc + (default=./build/externals/FLATBUFFERS/build/flatc) + tflite_schema path to tflite schema (i.e. schema.fbs) + circle_schema path to tflite schema (i.e. schema.fbs) +``` + +## example +``` +# @ host +$ tools/nnpackage_tool/sth2nnpkgtc/pb2nnpkgtc.sh 03_2k.pb img_placeholder conv2d_transpose + +# then, nnpkg is generated in {basename}.{outputname} +# it contains all of pb, tflite, circle, and golden data. + +$ tree 03_2k.conv2d_transpose +03_2k.conv2d_transpose +├── 03_2k.conv2d_transpose.circle +├── 03_2k.conv2d_transpose.pb +├── 03_2k.conv2d_transpose.tflite +└── metadata + ├── MANIFEST + └── tc + ├── expected.h5 + └── input.h5 + +# @ target +$ OP_BACKEND_ALLOPS=srcn \ +tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh 03_2k.conv2d_transpose +[ Run ] ./03_2k.out Pass +[Compare] ./03_2k.out Pass +``` |