Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
|
6 years ago | |
|---|---|---|
| .. | ||
| src | 6 years ago | |
| .gitignore | 6 years ago | |
| CMakeLists.txt | 6 years ago | |
| Makefile | 6 years ago | |
| README.md | 6 years ago | |
| dump_with_testcase_mge.py | 6 years ago | |
| main.cpp | 6 years ago | |
Load a model and run, for testing/debugging/profiling.
megvii3 build
bazel build //brain/megbrain:load_and_run
See mnist-example for detailed explanations on build.
There are two methods to dump model:
MegHair/utils/debug/load_network_and_run.py --dump-cpp-model /path/to/output, to test on random inputs. Useful for profiling.dump_with_testcase.py, and usedump_with_testcase.pyThe input file must be a python pickle. It can be in one of the following two
formats:
meghair.utils.io.load_network; in--data must be given and network output evaulated on currentvar0: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.{"outputs": [], "testcases": []}, whereoutputs is a list of output VarNodes and testcases is a list of testnumpy.ndarray. The expected outputs should also beAssertEqual. Youdump_with_testcase.py.dump_with_testcase_mge.pyThe input file is obtained by calling megengine.jit.trace.dump().
--data must be given.
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)"
The dumped file xornet.mge can be loaded by load_and_run.
MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台
C++ Cuda Python C SVG other