for https://github.com/Samsung/ONE/issues/2275#issuecomment-645103277
This issue is a guide to share how to create a tflite file easily from Python TF program for whom may want to know. :-)
Assume that we want to test cast op with int64 so let's call it cast_int64.
import tensorflow as tf ....res/TensorFlowPythonExamples/examples/cast_01/__init__.pypbtxt file
$ export MODEL='cast_01'
$ docker run -v /home/eric/:/home/eric -w /home/eric/work/1/ONE/res/TensorFlowPythonExamples \
tensorflow/tensorflow:1.15.0-py3 python3 tfpem.py ${MODEL}
cast_01.pbtxt file under res/TensorFlowPythonExamplesnightly but it would be better to use official version.
docker run -it -w "$(pwd)" -v /home/eric:/home/eric tensorflow/tensorflow:1-15-0-py \
python3 ../ONE/compiler/tf2tfliteV2/tf2tfliteV2.py --v1 ... <params>
ONE/compiler/tf2tfliteV2/readme.md for paramscast_int64.tflite is created.cast_int64.tflite with, e.g., netron to see if conversion is done as you wish. tflite converter does some optimization so tflite file sometime contains what you don't wish to be.cast_int64 dir under tests/scripts/framework/tests and create config.sh.on odroid,
run
$ LD_LIBRARY_PATH=./Product/out/lib ./tests/scripts/test-driver.sh --artifactpath=. --frameworktest
Does anyone know how to test locally without the following?
ask @wateret and @hseok-oh to upload the tflite file to test file server
Does anyone know how to run only cast_int64?
/cc @intom @ragmani for https://github.com/Samsung/ONE/issues/2275#issuecomment-645103277
Does anyone know how to test locally without the following?
Does anyone know how to run only cast_int64?
$ BACKENDS="cpu" ./Product/armv7l-linux.debug/out/bin/nnpackage_run --nnpackage ${cast_int64_dir} -l ${cast_int64_dir}/metadata/tc/input.h5 -d output.h5
$ h5diff -v ${cast_int64_dir}/metadata/tc/expected.h5 output.h5
But int64 type has a issue
Does anyone know how to test locally without the following?
Does anyone know how to run only cast_int64?$ BACKENDS="cpu" ./Product/armv7l-linux.debug/out/bin/nnpackage_run --nnpackage ${cast_int64_dir} -l ${cast_int64_dir}/metadata/tc/input.h5 -d output.h5 $ h5diff -v ${cast_int64_dir}/metadata/tc/expected.h5 output.h5But int64 type has a issue
I've tested with cast model that you converted.
Is it right?
If the result is right, I will create the draft PR for int64 test
intom@intom-PMBSB09A-Samsung-DeskTop:~/working_directory/2020/one/myPublicGit/ONE/Product/x86_64-linux.debug/out/bin$ ./nnpackage_run ~/working_directory/2020/one/models/cast_01 -l ~/working_directory/2020/one/models/cast_01/metadata/tc/input.h5 -d output.h5
... warmup 1 takes 0.652 ms
... run 1 takes 0.096 ms
===================================
MODEL_LOAD takes 34.344 ms
PREPARE takes 73.387 ms
EXECUTE takes 0.096 ms
- MEAN : 0.096 ms
- MAX : 0.096 ms
- MIN : 0.096 ms
- GEOMEAN : 0.096 ms
===================================
intom@intom-PMBSB09A-Samsung-DeskTop:~/working_directory/2020/one/myPublicGit/ONE/Product/x86_64-linux.debug/out/bin$ h5diff -v ~/working_directory/2020/one/models/cast_01/metadata/tc/expected.h5 output.h5
file1 file2
---------------------------------------
x x /
x /name
x x /value
x x /value/0
group : </> and </>
0 differences found
group : </value> and </value>
0 differences found
dataset: </value/0> and </value/0>
0 differences found
intom@intom-PMBSB09A-Samsung-DeskTop:~/working_directory/2020/one/myPublicGit/ONE/Product/x86_64-linux.debug/out/bin$
@intom It was right.
let me close this since it is a guide and i guess it's been shared to people.
Most helpful comment
I've tested with cast model that you converted.
Is it right?
If the result is right, I will create the draft PR for int64 test