c++代码
###
torch::jit::script::Module module;
//module = torch::jit::load("./resNetFpn-model-14_jit.pt");
module = torch::jit::load("./resNetFpn-model-14_jitscript.pt");###
try catch异常捕捉结果
```
10
[ CPULongType{} ]
cuda::is_available():0
cudNN::is_available():0
Unknown builtin op: torchvision::nms.
Could not find any similar ops to torchvision::nms. This op may not exist or may not be currently supported in TorchScript.
:
File "boxes.py", line 35
by NMS, sorted in decreasing order of scores
"""
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
```c++
确认下你导出的模型是CPU还是GPU的,然后再libtorch种指定推理引擎的时候需要跟模型一致。(✔)
首先确认下你的libtorch版本是cpu还是GPU的,你导出的模型要对应才行,也就是说libtorch是cpu的版本,你的模型应该导出cpu,gpu的对应(X)。
其次,你在python下加载下你的torchscript.pt模型看下能不能正确加载。libtorch版本最好和pytorch版本号一致。