Load a model and run, for testing/debugging/profiling.
Build MegEngine from source following README.md. It will also produce the executable, load_and_run
, which loads a model and runs the test cases attached to the model.
Dump the model by calling the python API megengine.jit.trace.dump()
.
Append the test cases to the dumped model using dump_with_testcase_mge.py.
The basic usage of dump_with_testcase_mge.py is
python3 dump_with_testcase_mge.py model -d input_description -o model_with_testcases
where model
is the file dumped at step 1, input_description
describes the input data of the test cases, and model_with_testcases
is the saved model with test cases.
input_description
can be provided in the following ways:
var0:file0;var1:file1...
meaning that var0
should usefile0
, var1
should use image file1
and so on. If there--resize-input
option.var0:#rand(min, max, shape...);var1:#rand(min, max)...
[min, max)
, optionally overriding its shape.For more usages, run
python3 dump_with_testcase_mge.py --help
Obtain the model file by running xornet.py.
Dump the file with test cases attached to the model.
python3 dump_with_testcase_mge.py xornet_deploy.mge -o xornet.mge -d "#rand(0.1, 0.8, 4, 2)"
Verify the correctness by running load_and_run
at the target platform.
load_and_run xornet.mge