Jetson AGX Xavier配置PyTorch与TorchVision流程
1 环境
Jetson AGX Xavier,JetPack 4.4 production release (L4T R32.4.3),Python 3.6.9。
需要安装的PyTorch与TorchVision对应的版本号为:
PyTorch v1.6 + torchvision v0.7.0-rc2
PyTorch与JetPack匹配的版本号:
PyTorch与TorchVision匹配的版本号:
2 安装PyTorch
PyTorch v1.6的wheels下载链接为:
https://nvidia.box.com/shared/static/yr6sjswn25z7oankw8zy1roow9cy5ur1.whl
安装命令为:
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
pip3 install Cython
pip3 install numpy ~/下载/torch-1.6.0rc2-cp36-cp36m-linux_aarch64.whl
3 安装TorchVision
安装命令为:
sudo apt-get install libjpeg-dev zlib1g-dev
git clone --branch v0.7.0-rc2 https://github.com/pytorch/vision torchvision
cd torchvision
sudo python3 setup.py install
cd ../
4 测试PyTorch与TorchVision
输入下列命令:
python3
import torch
print(torch.__version__)
print('CUDA available: ' + str(torch.cuda.is_available()))
print('cuDNN version: ' + str(torch.backends.cudnn.version()))
a = torch.cuda.FloatTensor(2).zero_()
print('Tensor a = ' + str(a))
b = torch.randn(2).cuda()
print('Tensor b = ' + str(b))
c = a + b
print('Tensor c = ' + str(c))
import torchvision
print(torchvision.__version__)
安装成功后的测试结果如下图所示: