1,介绍
torch2trt 是一个易于使用的PyTorch到TensorRT转换器
2,安装
sudo apt-get install libprotobuf* protobuf-compiler ninja-build
git clone https://github.com/NVIDIA-AI-IOT/torch2trt
cd torch2trt
python setup.py install --plugins # 虚拟环境
3,应用
# -*- coding: utf-8 -*-
import torchvision
import torch
from torch2trt import torch2trt
data = torch.randn((1, 3, 224

本文介绍了一个名为torch2trt的工具,它能够轻松地将PyTorch模型转换为TensorRT,实现高性能的推理。文章详细展示了如何安装和使用torch2trt,包括模型转换、误差对比及模型保存和加载的过程。
最低0.47元/天 解锁文章
3802





