- Install dependencies
- gcc >= 10
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 40
- cmake >=3.18
- python >= 3.6
- Install conan and cmake
pip install conan cmake
- Clone source
git clone https://github.com/kendryte/nncase.git
- Build
BUILD_TYPE=Debug
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
make -j8
cmake --install . --prefix ../install
- Test (optional)
Install dependencies (MacOS)
pip install tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.10.0
pip install torch==1.9.0 torchvision==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install pytest==6.2.5
Install dependencies
pip install tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.10.0
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install pytest==6.2.5
Export environment
echo "export LD_LIBRARY_PATH=\"${PWD}/install/lib:\$LD_LIBRARY_PATH\"" >> ~/.zshrc
echo "export PYTHONPATH=\"${PWD}/install/lib:${PWD}/install/python:${PWD}/tests:\${PYTHONPATH}\"" >> ~/.zshrc
source ~/.zshrc
Run tests
pytest tests
- Install dependencies
- Visual Studio 2019
- cmake >=3.18
- python >= 3.6
- Install conan cmake
pip install conan cmake
- Clone source
git clone https://github.com/kendryte/nncase.git --recursive
- Build
Open Developer Command Prompt for VS 2019
md out && cd out
cmake .. -G "Visual Studio 16 2019" -A x64 -DNNCASE_TARGET=k210 -DCMAKE_BUILD_TYPE=Release
msbuild nncase.sln
- Test (optional)
Install dependencies
pip install conan tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.10.0
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install pytest==6.2.5
Run tests
pytest tests
- Pull nncase docker image
docker pull registry.cn-hangzhou.aliyuncs.com/kendryte/nncase:latest
You can modify /etc/docker/daemon.json to speed up docker image.
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://182kvqe1.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
- Clone nncase
git clone https://github.com/kendryte/nncase.git
cd nncase
- Run docker
docker run -it --rm -v `pwd`:/mnt -w /mnt registry.cn-hangzhou.aliyuncs.com/kendryte/nncase:latest /bin/bash -c "/bin/bash"
- Build
rm -rf build && mkdir -p build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j32
make install
popd
- Test (optional)
export PYTHONPATH=`pwd`/python:`pwd`/build/lib:`pwd`/tests:$PYTHONPATH
export LD_LIBRARY_PATH=`pwd`/build/lib:$LD_LIBRARY_PATH
pytest tests/importer/onnx/basic/test_relu.py